ERC-20 is a standard, or set of rules, which governs cryptocurrency tokens on the Ethereum Blockchain. ERC-20 tokens, like other cryptocurrencies, are assets that have a value and can be transferred or traded. Unlike some cryptocurrencies which have their own blockchains, ERC-20 tokens do not have their own blockchain and instead run on the Ethereum Blockchain. There have been shortcomings discovered in ERC-20 that have necessitated development of further standards, namely ERC-223. Where ERC-223 tokens are not currently compatible with the ERC-20 standard, adoption has been deferred until interoperability can be resolved. 

 

Share this:

What is Ethereum?

Ethereum is a decentralised blockchain protocol with its own programming language, Solidity. While the Ethereum blockchain has its own currency, Eth, Ethereum was developed to enable smart contracts and decentralised applications (DAPPS) to be built on its blockchain by third parties. When a smart contract is built on the blockchain, tokens are distributed according to the contract terms. While a smart contract can in theory use any token, the Ethereum community created the ERC-20 standard token as a foundation to govern all tokens on the blockchain. This common foundation for Ethereum based tokens simplifies interoperability with exchanges, wallets, and other tools outside the Ethereum blockchain. 

 

The ERC-20 Token Standard

All tokens issued by smart contracts and projects on the Ethereum Blockchain must have six mandatory ERC-20 Functions. There are also three optional functions for tokens created by a smart contract on the Ethereum Blockchain. 

 

Mandatory Conditions

  • TotalSupply: This function dictates the number of tokens that can be created by a smart contract, when this number is reached no more tokens can be created.
  • BalanceOf: The “BalanceOf” function returns (knows) the balance of tokens at any address proving possession. 
  • Transfer: This function allows tokens to be transferred from the remaining supply held by the smart contract to a user account proving ownership. 
  • TransferFrom: The “TransferFrom” function facilitates the transfer of tokens from one user account to another. The “TransferFrom” function is used in combination with the “Approve” function for transfers from a user account to a smart contract. This function proves the transfer of ownership.
  • Approve: This function checks that a transfer function can be completed given the total supply. 
  • Allowance: The allowance function checks the balance of a user account to verify that a “TransferFrom” function can be completed given their balance. 

 

Optional Conditions

  • Name: Tokens created by a smart contract on the Ethereum Blockchain can be given a unique name to identify them such as when a new cryptocurrency is created on the Ethereum blockchain. you are likely familiar with many of these unique token names such as Chainlink, Tether, Maker and many others.  
  • Symbol: Similar token names a symbol can be assigned to a token. For example, Chainlink has been assigned the symbol “Link”
  • Decimal: This condition dictates the divisibility of a token. A token with zero decimal cannot be divided and will only appear in whole numbers while a token with one decimal can be divided by 10 can therefore be traded in multiples of 0.1 tokens. The maximum decimals a token can have under the ERC-20 standard is 18.

 

Shortcomings of the ERC-20 Standard

A significant shortcoming of ERC-20 is evident when the transfer function is used instead of the “TransferFrom” function to move tokens from a wallet address to a contract address. When this incorrect function combination is used the contract will not recognize the tokens and the transferred value will become lost inside the contract resulting in a loss for the user. This can be avoided with programming that uses the “TransferFrom” and approves functions as intended however millions of dollars in assets have already been lost to this issue. ERC-223 and ERC-777 have both been proposed to improve the ERC-20 standard and resolve this shortcoming.  

Related Articles