tutorials

How to Mint Your Own Crypto on Shardeum Testnet – Part 2

Shardeum Sphinx Dapp testnet was launched recently and this is the right time for you to build your dapps and become a leader in the...

< Back
Back to top
  • Share

What is ERC-20 Token?

ERC 20 tokens are issued on the Ethereum network. They have emerged as the technical standard on the Ethereum blockchain for token implementation and provides a list of rules that all Ethereum-based tokens must follow. Side note : Ethereum is a layer 1 blockchain that carries several independent and dependent L1 and L2 blockchains as a result of its highly automated/virtualized EVM.

‘ERC’ stands for ‘Ethereum Request for Comment’. ERC-20 specifically has six different coding functions. In terms of implementation of the coding for ERC-20 tokens, the six basic coding functions are as follows :

  1. Total supply
  2. Balance of
  3. Allowance
  4. Transfer
  5. Approve
  6. Transfer from

Create and Deploy your ERC-20 Token using Remix

In this step-by-step tutorial, you will learn how to create and deploy an ERC-20 token on Shardeum Sphinx Dapp testnet (betanet). We will use Metamask and Remix IDE for this tutorial.

Add Shardeum Network to Metamask/Claim Token

MetaMask allows users to store and manage account keys, broadcast transactions, send and receive Ethereum-based cryptocurrencies and tokens, and securely connect to decentralized applications through a compatible web browser or the mobile app’s built-in browser. Click here to install the MetaMask extension on your browser.

And follow this instruction to add Shardeum to MetaMask wallet and claim test 100 $SHM tokens from Sphinx Dapp faucet.

Writing the Code Using Remix

We are using Remix IDE for writing the smart contract as mentioned above. In Remix, create a new contract file. As a reference, I named mine as ‘ShardeumERC20Token.sol’ – you can name it as you want. And, in the contract, write the following code:

//SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol";

contract ShardeumERC20Token is ERC20 {

   constructor(string memory _name, string memory _symbol) ERC20(_name, _symbol){
       _mint(msg.sender, 10000 * 10 ** 18);

   }
}

Let me explain the code in brief for your reference :

  1. pragma solidity ^0.8.0 – This line specifies the compiler version of Solidity to be used. ^0.8.0 means any version greater than 0.8.0.
  2. import – This line imports the ERC-20 token standard from OpenZeppelin (OZ).
  3. contract ShardeumERC20Token is ERC20 – This specifies a new contract, named LW3Token, in our Solidity file. Also, it says that this contract is an instance of ERC20.
  4. constructor – Essentially, we created constructor function that is called when the smart contract is first deployed.
  5. _mint – An internal function within the ERC20 standard contract, which means that it can only be called by the contract itself. External users cannot call this function.
  6. 10 * 10 ** 18 – (which is actually 10 ^ 18) specifies that you want 10000 full tokens to be minted to your address.

Compiling the Smart Contract

Compile your contract by going over to the ‘Compiler’ tab in Remix and selecting ‘ShardeumERC20Token.sol’, and then hit ‘Compile’.

Compiling Smart Contract Shardeum testnet

Deploying Smart Contract on Shardeum Sphinx Dapp (Testnet)

Let’s deploy a fixed supply of 10000 Tokens (You can change it to other supply at code level).

Go to the ‘Deployer’ tab in Remix.

Select the ‘Injected Web3’ environment (make sure you select Shardeum Sphinx Dapp 1.X Network), and connect your MetaMask wallet.

Now, select the ‘ShardeumERC20Token.sol’ contract, and enter values for the constructor arguments ‘_Name’ and ‘_Symbol’ as shown in the image below.

Deploying smart contract Shardeum Testnet Liberty

Proceed to click ‘Transact’ and approve the transaction in ‘Metamask’ to deploy your contract!

Deploy Smart Contract via MetaMask Shardeum Testnet Liberty

You have now successfully deployed ERC-20 Token on Shardeum Sphinx Dapp!!

After deploying, click the ‘Copy Address’ button to copy the contract address.

Shardeum Explorer Testnet Smart Contract

You can now go to Shardeum Explorer and search for your contract address and you should be able to see it there!

Shardeum Explorer Testnet Smart Contract

Take a screenshot of it and feel free to promote your newly created token on social media channels. Note these tokens have no real world value. Ethereum based developers can use them for paying transaction/gas fees to deploy and develop their projects/dApps on Shardeum testnet and become a leader of the ecosystem by the time Shardeum launches mainnet in Q4 of 2022. The other great thing about Shardeum is you don’t have to worry about rising gas fees again because the estimated gas/transaction fee on the network will be $0.01!

Viewing your ERC-20 Tokens in MetaMask

Now, copy your contract address

Open Metamask and click ‘Import Tokens’ in the Assets tab

Cryptocurrency Mint Shardeum Testnet MetaMask

You can now enter your ‘Token Contract Address’, and it should detect the name and number of decimals automatically.

Then click ‘Add’, and you will see your balance in MetaMask!

MetaMask Shardeum token testnet

Congratulations! You’ve successfully deployed and minted your own ERC-20 token on Shardeum testnet!

And here is the GitHub link of the code used to create my own cryptocurrency on Shardeum.

Popular Searches

Why to Invest in DeFi Coins and Token  |  Mobile App Technology Stack  |  How to Buy Real Estate in the Metaverse  |  Blockchain Scalability Solutions  |  Public Blockchain Examples  |  Top Altcoins  |  What is Proof of Work in Blockchain  |  Crypto Cloud Mining  |  Best Place to Mint NFT  |  What is Stake in Crypto  |  What is a Governance Token  |  Benefits of Blockchain  |  What is Blockchain Security  |  Can Blockchain be Hacked  |  What is Crypto Metaverse  |  How to Keep Crypto Safe  |  Bitcoin VS Ethereum  |  What is a Crypto Whale  |  What is Staking in Crypto  |  Ethereum that are Compatible with the EVM


Opinions expressed in this publication are those of the author(s). They do not necessarily purport to reflect the opinions or views of Shardeum Foundation.

About the Author : Vaijanath is into Crypto & Blockchain space since 2017. He is a BUIDLer, Trader, Investor, Cryptopreneur and man of many trades. You can follow him on Twitter

The Shard

Sign up for The Shard community newsletter

Stay updated on major developments about Shardeum.