Moonbeam Truffle Box¶
The first release of a Truffle box for Moonbeam. With it you will find a Truffle boilerplate setup to get started deploying smart contracts on Moonbeam quickly.
To get started with the Moonbeam Truffle box, if you have Truffle installed globally, you can execute:
mkdir moonbeam-truffle-box && cd moonbeam-truffle-box truffle unbox PureStake/moonbeam-truffle-box
Nevertheless, the box has also Truffle as a dependency in case you do not want to have it installed globally. In such a case, you can directly clone the following repository:
git clone https://github.com/PureStake/moonbeam-truffle-box cd moonbeam-truffle-box
With the files in your local system, the next step is to install all dependencies by running:
npm v7.0.15you might have some errors when running
npm install. To fix this you can downgrade npm to an older release such as
7.0.8by running, for exmaple,
npm install -g [email protected].
The dependencies installed are the following:
- EthereumJS wallet: a lightweight wallet implementation.
- Web3 Provider Engine: a tool for composing custom Web3 providers.
- Truffle: this is not needed if you have installed it globally.
- Moonbeam Truffle Plugin: a tool to easily create your own Moonbeam development node for quick and iterative development (uses Docker).
Moonbeam Truffle Box is pre-configured with two networks: Moonbeam Development and Moonbase Alpha TestNet. To deploy in the development network please check the Moonbeam Truffle Plugin section to install and start your own local node.
node_modules/.bin/truffle migrate --network dev
node_modules/.bin/truffle migrate --network moonbase
Note: if you have Truffle installed globally, you can replace
Moonbeam Truffle Plugin¶
The plugin is used to get you started with a local development Moonbeam node quickly. You can check all available commands with the help flag:
./node_modules/.bin/truffle run moonbeam --help
The following commands are available:
In this context, installing means downloading the Docker image of the Moonbeam development node (requires Docker to be installed).
node_modules/.bin/truffle run moonbeam install
Start the development Moonbeam node.
node_modules/.bin/truffle run moonbeam start
Stop the development Moonbeam node. This will remove the container, thus purging the chain.
node_modules/.bin/truffle run moonbeam stop
Pause the development Moonbeam node.
node_modules/.bin/truffle run moonbeam pause
Unpause the development Moonbeam node.
node_modules/.bin/truffle run moonbeam unpause
Shows the status of the development Moonbeam node.
node_modules/.bin/truffle run moonbeam status
Removes the Docker image of the Moonbeam development node.
node_modules/.bin/truffle run moonbeam remove
Truffle Plugin Verify¶
As a convenience, the
truffle-plugin-verify plugin has also been included in the Moonbeam Truffle Box. You can use this plugin to verify smart contracts automatically on Moonscan. For more information on how to use the plugin with Moonbeam, you can checkout the Using the Truffle Verify Plugin section of the Moonbeam documentation.
We welcome any feedback, so feel free to reach out through our official Discord Channel.