Using Truffle for Deploying Smart Contracts on GODE
Last updated
Last updated
In this tutorial, you will learn to create, compile nad deploy smart contract on the GODE Smart Chain network using the Truffle IDE.
There are a few technical requirements before we start. Please install the following:
Windows, Linux or Mac OS X
Recommendations for Windows If you're running Truffle on Windows, you may encounter some naming conflicts that could prevent Truffle from executing properly. Please refer to the to find solutions for resolving naming conflicts.
Once the above mentioned softwares are installed, we only need one command to install Truffle:
To verify that Truffle is installed properly, type truffle version
on a terminal. If you see an error, make sure that your npm modules are added to your path.
If you're new to Truffle then please follow the by truffle, To setup the truffle environment.
To use most Truffle commands, you need to run them against an existing Truffle project. So the first step is to create a Truffle project.
Once this operation is completed, you'll now have a project structure with the following items:
contracts/: Directory for Solidity contracts
migrations/: Directory for scriptable deployment files
test/: Directory for test files for testing your application and contracts
truffle-config.js: Truffle configuration file
To compile a Truffle project, change to the root of the directory where the project is located and then type the following into a terminal:
GODE
Go to truffle-config.js
Update the truffle-config with gode
-network-crendentials.
Run this command in root of the project directory:
Contract will be deployed on Binance Chain Chapel Testnet, it look like this:
Note Remember your address, transaction_hash and other details provided would differ, Above is just to provide an idea of structure.
🎉 Congratulations! You have successfully deployed GRC20 Smart Contract. Now you can interact with the Smart Contract.
The recommended way to verify a smart contract is using the plugin. It is easier to read and imports and licenses are maintained.
Verified using Truffle
You need to deploy with Truffle to verify with the Truffle verify plugin.
Get API key: https://explorer.godechain.com/myapikey
Configure the plugin in truffle-config.js
using the following command
You should see the following output:
For creating a scaffold project for getting started, you can use the , GODE Starter Box for an eample template to start devloping on GODE Smart Chain.
For this tutorial, we have used the as an example, which creates a token that can be transferred between accounts. Use the command truffle unbox metacoin
to unbox the metacoin box.
NOTE: You can use the truffle unbox <box-name>
command to download any of the other . Another alternative is to create a bare Truffle project with no smart contracts included using the truffle init
command.
You can write your own smart contract or download the and place it in the contracts
directory.
NOTE: Notice, it requires mnemonic to be passed in for Provider, this is the seed phrase for the account you'd like to deploy from. Create a new .secret file in root directory and enter your 12 word mnemonic seed phrase to get started. To get the seedwords from metamask wallet you can go to Metamask Settings, then from the menu choose Security and Privacy where you will see a button that says reveal seed words, refer for more details.
You can check the deployment status here: or
GitHub Project:
Truffle has a GodeScan plugin: