Discover the crypto universe in depth

What is an ERC20 token on Ethereum?

The ERC20 standard for Ethereum tokens

ERC20 is a kind of norm (a standard) used to define a common set of rules for Ethereum blockchain smart contracts that use this norm.

It is the standard used to generate “fungible” tokens, i.e. tokens that are all very similar, e.g. Bitcoin (BTC) or Ethereum (ETH) are fungible, euros or dollars are fungible, each dollar has the same value, which is the opposite of a non-fungible token (NFT) which has a unique value, like a unique work of art. 

ERC20 was the most successful standard during the 2017 ICO bubble (when ETH was trading at $700) as almost all cryptocurrency fundraising was done on it. Since then, two standards have been used when issuing new tokens: ERC20 and ERC721, the standard used for NFTs (non-fungible tokens)

This standard was created and proposed in November 2015 by Fabian Vogelsteller, an Ethereum crypto developer. The total list of available ERC20 tokens is available at this address.

ERC20 and Ethereum (ETH) transaction fees

As we have seen in this article, it is necessary to use gas to pay transaction fees, so it is necessary to pay the native cryptocurrency Ethereum (ETH) token in Ether to move ERC20 tokens from one wallet to another wallet or to send funds to a smart contract in the Blockchain.

The common rules to be retained from this standard

The standard defines functions such as:

  • transferring tokens from one account to another
  • obtaining the current balance of tokens in an account wallet
  • obtaining the total token supply available on the network

The creation of ERC20 tokens is done in the following way: a token contract is deployed on Ethereum (ETH) network, it is a smart contract with a register of who owns how many tokens.

Understand by whom an Ethereum public key:

For example, on this table you can see the list of holders as well as their token balance, that’s how smart contracts know how much Tether (USDT), Chainlink (LINK), or Uniswap (UNI) you have for example! 

When you make a transaction you send your ERC20 tokens from your address to a different address, this means that you pay a gas fee to make this transaction, the token contract will update its registry to change the balance of the issuer of the transaction and the beneficiary of the transaction, example in picture :

Images by Ethereum France

The benefits of using the ERC20 token standard for application development

The advantage of defining a common standard for all ERC20 tokens is that we can foresee what these tokens can and cannot do, which allows us to control the perimeter when developing applications such as Wallets that manage ERC20 tokens like Metamask or Ledger or Blockchain Explorers like Etherscan.

It also facilitates the management of tokens of the same standard for decentralized applications (dAPP) such as Uniswap, AAVE, Sushiswap, 1inch, etc.

This also limits the number of bugs and simplifies the auditing of the computer code used for contracts. Each ERC20 token is audited by companies specialized in the security of smart contracts such as Certik.

What are the ERC20 Ethereum token standard specifications for geeks to learn

The functions and events that an “ERC20” token must be able to manage are the following:

  • [name] is the function that should return the name of the token (e.g. Chainlink or Uniswap or VariabL Contribution Token);
  • [symbol] must return the symbol of the token (e.g. “LINK” is the symbol of the Chainlink crypto token, “UNI” is the symbol of Uniswap crypto token, “FTM” is the symbol of Fantom crypto token);
  • [decimals] should return the number of decimal places to be considered for the token. Token balances are handled without decimals by ERC20 contracts – for a person with 1 token to 18 decimal places, the balance of function defined below will return 10000000000000000000000. In general, 18 decimal places are chosen for an ERC20 token.
  • [totalSupply] should return the total number of tokens that exist in the Ethereum network;
  • [balanceOf] must allow the number of tokens held by an account to be viewed;
  • [allowance] shall return the number of tokens that an address is allowed to remove from the token contract;
  • [transfer] is the function that allows an account with tokens to send tokens to another account
  • [transferFrom] allows tokens to be transferred from one address to another, without the address sending the transaction being the one holding the tokens
  • [approve] is a function that allows the holder of a token contract to approve a withdrawal for a specific amount from a specific account wallet (changes the [allowance] of that account)

These functions also need to trigger two events:

  • -Transfer- triggers for each request to the [transfer] or [transferFrom] function
  • -Approval- triggers for each request to the [approve] function

As you can see, the ERC20 is a kind of standardized API to facilitate the work of developers and not to make them reinvent the wheel.

Special thanks to Ethereum France, who created this very clear article and ERC20 Ethereum documentation.