Horizen EON is our first public proof-of-stake sidechain and a fully EVM-compatible smart contracting platform that allows developers to efficiently build and deploy dapps on Horizen, while fully benefiting from the Ethereum ecosystem.
In this step by step guide below, we will walk you through the process of creating an ERC-20 Token on Gobi Testnet – the permanent public testing environment for EON.
Tools used in this tutorial
We assume you already have MetaMask installed on your browser for this tutorial. If you do not, you can download MetaMask here.
STEP 1: Connect Gobi Testnet to MetaMask
You can easily connect Gobi Testnet to MetaMask through Chainlist. Follow the instructions on the screen, Gobi Testnet should appear on your MetaMask:
STEP 2: Claim test token – TZEN
You’ll need TZEN as transaction fees to send your newly created tokens. You can get TZEN from the Gobi test token faucet. Copy and paste your Metamask address in the “Wallet Address” field on the faucet.
STEP 3: Create your code on Open Zeppelin and create a new contract on Remix
Now we are ready to create your ERC-20 token! To do so, a simple way is via the Open Zeppelin wizard.
In this tutorial, we are going to create a Javier Token in honor of our team member Manon’s #ZenCat Javier. Here is him supervising Manon.
- Select the “ERC-20” tab
- Complete the following fields:
- Name: think of a cool name for your token
- Symbol: your token symbol
- Premint: The amount of token you want to create
- When you are done, click on “Open in Remix” and it will lead you to the Remix webpage
- Rename your file according to the name of your token/ smart-contract
STEP 4: Deploy your smart contract on Gobi Testnet
To deploy on the Gobi testnet, first, make sure Gobi testnet is selected and connected on MetaMask
- On Remix, go to “Deploy and run transactions” by clicking the Ethereum icon on the left
- Select “Injected Provider – MetaMask”
- Be sure that the address here matches your MetaMask address in the “ACCOUNT” field
Go on the Compiler and make sure that the “Enable Optimization” is checked
- Click on “Confirm” on MetaMask
STEP 6: Verify your smart contract on the Gobi block explorer
- On Remix, your contract should appear on the left. Click on “Copy”
- Import your token on MetaMask
- Click on “import a token”
- Paste the contract address
- Click on “Add a custom token”
- Go on the Gobi Explorer https://gobi-explorer.horizen.io/
- Paste on the search bar and press “Enter”
- Your contract should appear
STEP 7: Flatten and publish
- On Remix, go back in “File Explorer”
- Use the right-click and select “flatten”
- Click on the flattened contract
- Copy the data on the right, you can select all with “Crtl+A”
- Go back on the Gobi Explorer at your contract address and click on “Code” then on “Verify and Publish”
- Select “Via flattened source code”, then click on “Next”
- Make sure to have the same data on the Solidity Compiler, and the data that appears on the Gobi block explorer and paste the code on “Enter the Solidity Contract Code”
- Make sure to enter the “Contract Name”. Here “Javier Token”
- Click on Verify and Publish. Your code is now verified!
STEP 8: Send tokens
- Go on MetaMask, to your newly created token, and click on “send”
- Enter the address where you want to send your tokens to
- Enter the amount and click on “Next”
- Click on “Confirm”
- The tokens are sent, and you can view them on the Gobi explorer!
The recipient may have to import your token in MetaMask. To do so, he must click on “import a token” and then paste the token contract address available on the Gobi explorer. (You can also send him the token contract address, the one you used to import the token on your MetaMask at the beginning of the tutorial)
We hope you find this tutorial helpful! If you run into issues or have any additional questions, you can reach out to us on our Discord in the #eon channel.