Create ERC20 Custom Tokens
Required Prior Knowledge
This guide assumes you are familiar with the concept of tokens in blockchain, Ethereum Request for Comments (ERCs)(also known as Ethereum Improvement Proposals ( EIP)) , NFTs, Smart Contracts and have already tinkered with Solidity.
You should also have basic knowledge on how to create and deploy a smart contract.
About ERC20
ERC20 is a standard for fungible tokens and is defined in the EIP-20 Token Standard by Ethereum.
With the ERC20 standard, you can create your own tokens and transfer them to the EVM on IOTA Smart Contracts without fees.
This guide will use the Remix IDE, but you can use this contract with any IDE you are familiar with.
1. Create the Smart Contract
Create a new Solidity file, for example, ERC20.sol
in the contracts folder of
your Remix IDE and add this code snippet:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract ExampleERC20Token is ERC20 {
constructor() ERC20("ExampleERC20Token", "EET") {
_mint(msg.sender, 1000000 * 10 ** decimals());
}
}
This imports all functions from the OpenZeppelin ERC20 smart contract and creates a new ERC20 token with your name and Symbol.
OpenZeppelin provides many audited smart contracts and is a good point to start and learn.
You can change the token name ExampleERC20Token
and the token symbol EET
for anything you want.
Deploy a Solidity Smart Contract following our how to Deploy a Smart Contract guide.
2. Add Your Custom Tokens to MetaMask
Once you have deployed your contract, you can add your new custom token to your Metamask account.
- Open Metamask, and click on the transaction that created the contract. From there, you can simply click
on
View on block explorer
to visit the transaction details. Alternatively, you can copy the transaction ID and visit the IOTA EVM Explorer, ShimmerEVM Explorer or EVM Testnet Explorer and use the search bar to find transaction.
- Copy the contract address from the transaction details, and import your custom ERC20 tokens into MetaMask.
3. Have some Fun
Now you should see your token in MetaMask. You can send them to your friends without any fees or gas costs.
You also can ask in the Discord Chat Server to send them around and discover what the community is building on IOTA Smart Contracts.