CREATE YOUR FIRST GRC-20 TOKEN
Last updated
Last updated
The body of a GRC-20 token contains the methods and events a GRC-20 token must have.
A GRC-20 token must be able to:
Transfer tokens from one account to another
Return the balance of an account
Return the total tokens available in the token
Transfer tokens to an account
This is an example of how to create and deploy a simple GRC-20 token on the Gather testnet. You can follow the same steps for the mainnet after changing the configuration from testnet to mainnet.
Metamask or any web3 wallet configured with Gather testnet.
Testnet GTHs.
For this guide, we will be using remix as IDE and MetaMask as our wallet.
Open Remix online compiler. https://remix.ethereum.org/
In contracts create a new file token.sol
and add the following code there.
You can get the code from here as well - https://github.com/GatherNetwork/GRC-20-Token.git
Compile token.sol
Switch to Gather Testnet Network in your MetaMask.
In environments of Remix, select injected web3 and connect an account with enough testnet GTHs.
Fill in the details for the deployment section and deploy your contract.
Please note that the unit provided for the field initial supply is in WEI.
Eg: For creating 1,000 tokens, for the initial supply you need to enter
1,000 * 1,000,000,000,000,000,000 = 1,000,000,000,000,000,000,000
In this case, the total number of DEM tokens minted will be 1000000000000 * 1e-18.
This will open your MetaMask extension and ask you to confirm the pending transaction. Click the Confirm button on the MetaMask popup.
You have successfully created and deployed a GRC-20 token on the Gather test network. You check your contract details on the gather testnet block explorer.