18 Points One Must Know about ERC20 (Ethereum Request for Comment 20)

Written By Dr. Amol Dhumane


“ERC20 is an API that governs how the token should be built”

-----------------------------------------------------------------------------------------------------------------------------

Why to use ERC20?

We want our token to be built to be compliant and widely accepted e.g. we want this token to be able to be transferred from one account to the other, we want the token to be bought and sold on a cryptocurrency exchange, we want the token to be sold in an Initial Coin Offering (ICO).  

-----------------------------------------------------------------------------------------------------------------------------

  1. Exists on the Ethereum platform 
  2. These tokens live on Ethereum blockchain. They completely rely on Ethereum blockchain and platform.
  3. The native currency on Ethereum is Ether. 
  4. Ethereum platform also supports some tokens. These tokens can be created with smart contracts. 
  5. These contracts create, manages and keep the track of each token holder balances. 
  6. For getting tokens, some Ether need to be given to the smart contract, that will generate some tokens for us. 
  7. So while deploying the smart contract, we need to be very careful as a single bug in smart contract can make us to lose all the money invested. Once the smart contract is deployed on the Ethereum platform, we cannot change or modify it. That’s why smart contracts are said to be immutable. 
  8. For different tokens, different contracts are need to be written as each token is different from the other. 
  9. If we want to make our token available on the Exchange, the exchange need to write custom code for interacting with our contract and for allowing the people to trade with our token. Same thing is applicable for wallet providers. 
  10. Supporting large number of tokens is complex process as well as time consuming also. So instead, community proposed a standard called as ERC20. 
  11. ERC20 is an official protocol for proposing improvements to the Ethereum (ETH) network. 20 in ERC20 is a proposal identifier. 
  12. ERC20 is a guidelines or standard need to be followed during your own token generation process. 
  13. It contains 6 mandatory functions that your smart contract need to implement and 3 optional ones. 
  14. Optional things are ‘name’ of token ‘symbol’ of the token and ‘decimals’ which denote the divisibility of the token into number of decimals. 
  15. The compulsory functions include ‘totalsupply’ of your token (when we reach to that limit, smart contract won’t create any further tokens), ‘balanceOf’ method returns the number of tokens a given address has, further there are two transfer methods: first ‘transfer’ takes the number of tokens from ‘totalsupply’ and gives them to the user and second method ‘transferFrom’ is used to transfer the tokens between the users. Last two functionality are ‘approve’ and ‘allowance’ methods. ‘Approve’ makes sure that our smart contract gives certain amount of tokens to the user by considering ‘totalsupply’ and ‘allowance’ method verifies that one user has sufficient amount of tokens to send to someone else. 
  16. If you want to create your ERC20 tokens, you need to implement ERC20 interface. 
  17. Tokenfactory.com website help to create tokens. 
  18.  ERC20 is not perfect. It gives us guidelines but we are fee to implement the functions however we like.

-----------------------------------------------------------------------------------------------------------------------------

Refer following link for more information:

https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md

-----------------------------------------------------------------------------------------------------------------------------

 

Comments