How to create an ERC-20 token
Creating a crypto token doesn't require you to be an expert - whether you're trying to raise money or pursue other purposes. In this tutorial, I’ll walk you through creating your own ERC-20 token on the Ethereum network, regardless of your knowledge of DeFi, ETH, and blockchain technology.
With the rise in popularity of token development in the crypto space over the last couple of years, you’re now able to create and deploy your token in minutes - and knowing how to code is not a requirement. Let’s get into it.
Why build your ERC-20 token?
Creating an ERC-20 token allows for facilitating transactions on the Ethereum blockchain and for creating and distributing a digital asset or cryptocurrency. Additionally, it provides flexibility in the design and functionality of the token, as well as potential integration with other smart contract applications on the Ethereum network. If you come across an Ethereum smart contract, it's most likely ERC-20 compliant.
Overall, creating an ERC-20 token can provide numerous benefits and opportunities for businesses and individuals. This is thanks to the ERC-20 token standard.
So what is the ERC-20 token standard?
Look at ERC-20 as a set of rules that makes it easy for smart contracts to interact. The ERC-20 token standard allows developers to create Ethereum network tokens compatible with other products and services. It sets the rules that all Ethereum-based tokens must follow.
Below you’ll find the set of rules and an explanation of what they allow the smart contract to do.
This function is responsible for returning the total supply of the tokens allocated by the smart contract regardless of owner.
This function allows the token smart contract to return the number of tokens owned by a wallet address. If you create a token and send it to a wallet address, you’ll be able to see how many tokens you have left.
This function transfers tokens from the sender’s address to the recipient’s address, like a typical cryptocurrency transaction.
This function automates moving tokens from the sender to the recipient at a specific date and time.
This function allows an address to withdraw tokens from the owner’s address.
This function allows an address to transfer tokens to another address to retrieve tokens from it.
ERC-20 serves a vital role in the Ethereum network because of this. The rules work like technical guidelines (the ERC-20 token standard) for the developers to follow, simplifying the process of creating a new token or building a product for the blockchain.
There are several ERC standards on the Ethereum blockchain, all standards with different use cases. These standards were created to optimize the Ethereum ecosystem in different ways, and the ERC-20 is the most well-known standard within the whole crypto space. Some other popular ERC standards are:
The NFT standard. As non-fungible tokens (NFT) can’t be transferred using the ERC-20 standard, ERC-721 was developed.
The ERC-1155 standard provides an efficient solution for transferring both fungible and non-fungible tokens in a single transaction.
How to create your ERC-20 token
So you’ve decided to create your ERC-20 contract. You can write code or have it automatically created using a token maker platform. The latter allows you to create your ERC-20 token without any programming knowledge.
Token maker platform
Having a token created is easier and cheaper than you probably think. Using the right platform, you can have an Ethereum token developed and deployed in minutes. “Deployfreetoken” is a token maker platform specialized in that. You can find their platform here:
Writing code on Solidity
Following the ERC-20 token standard, you’ll write a code containing six mandatory functions. These functions will allow integration with other contracts and products on the Ethereum network: totalSupply, balanceOf, transfer, transferFrom, approve and allowance.
OpenZeppelin is considered the standard library maintaining ERC contracts classes, and I recommend using their template when coding.
The template will guide you throughout the coding process.
Ethereum Smart Contract Token Deployment
Once your ERC-20 token is created, it's time to deploy it on the Ethereum blockchain. One way to do this is by using MetaMask and connecting to the Ropsten Test network. This allows for testing your ERC-20 token on the testnet without spending real Ethereum.
Next, go to a website such as https://remix.ethereum.org/, which allows for easy deployment of smart contracts. Navigate to the "Compile" tab. You will input your ERC-20 token code and compile it into a .json file.
Go back to the "Run" tab and select "Injected Web3" under the "Environment" dropdown menu. Then, choose your Ropsten Test Network account from MetaMask and click "Deploy.”
MetaMask will automatically verify the token symbol and number of decimals based on the contract address.
After the transaction is processed, you can check on Etherscan to see your deployed ERC-20 token contract.
Congrats, you have successfully deployed your token!
Be sure to store the token address for future reference safely, and remember to switch back to the main Ethereum network when it's time to use your token for real transactions.