Ethereum 101Learn

What is an ERC20 token?

ERC20 is generally a protocol standard that defines certain rules for issuing tokens on the Ethereum network. The term ERC stands for Ethereum Request for Comments while 20 stands for a unique ID number to distinguish this standard from others.

These tokens are designed and used solely on Ethereum, which is a decentralized and open-source computing platform that enables the creation of smart contracts and decentralized applications (DAPPS).

In other words, if Ethereum is the Internet, then all DApps are the websites that exist within it.

Many people may think, why do we need a separate token when we have Ether?

Imagine going to an exhibition. We pay the entrance fee and get a ticket that gives us access to the entire exhibition area. We can even pay for our food with this ticket. In this example, the exhibition is the DAPP, money is Ether, and the ticket is the token.

Read Also: What is Ethereum?

Token Types

Over the years, many people have created tokens of different purposes. Some are used to avail of services within their DApp, while others are created as a form of securities. Nevertheless, ERC20 tokens are generally of two types: usage token and work token.

Utility Token

Usage tokens, also called utility tokens, are the usable tokens that work like native currency in their respective DApps. One good example of this type of token is Golem. Users who want to utilize Golem services need to pay with Golem Network Token (GNT). These tokens have monetary value. However, they don’t grant any special rights or privileges within the network itself.

Work Token

Users become a sort of shareholder in DApps by owning work tokens. These are also called governance tokens. Some projects grant token holders the ability to allocate funds from a project treasury to contractors who perform various project services. Decentralized Autonomous Organization (DAO) tokens are good examples of this type of token. DAO token holders have the right to vote on whether a particular DApp will receive funding from the DAO’s treasury.

Anatomy of ERC20

The ERC20 standard has a set of rules and standards in order that they can be shared, exchanged for other tokens, or transferred to a crypto wallet. This set of rules contains three optional rules, six mandatory rules, and two logging event rules.

3 Optional Rules

The following are the optional rules which are part of the ERC20 protocol’s general set of rules:

  1. Token Name: Though it is not really mandatory to name the token, it is important to give it an identity.
  2. Symbol: Symbols can help for better branding and will make people easily recognize the token.
  3. Decimal: The token can be divisible up to 18 decimal places. Developers set the decimal to 0 so the token cannot be divisible.

6 Mandatory Rules

The following are the executable mandatory functions which are also the part of the general set of rules of the ERC20 protocol

  1. TotalSupply: The TotalSupply function identifies the total number of ERC20 tokens created. Here, the user can determine the total number of tokens around the ecosystem.
  2. BalanceOf: The BalanceOf function will help determine the number of tokens a given address has in its account.
  3. Transfer: The Transfer function is generally used for transferring a certain number of tokens from the total supply of a smart contract to a user account.
  4. Approve: The Approve function is used to check the transaction against the total supply of tokens.
  5. TransferFrom: The TransferFrom function generally allows a user to transfer tokens to another user.
  6. Allowance: The Allowance function is used to check the balance of the user’s account and will cancel the transaction if there are insufficient tokens.

Ethereum network runs ERC20 smart contracts, a set of coded instructions. Using Solidity as the programming language, it is based on the IFTTT logic called IF-THIS-THEN-THAT logic. The main part of an ERC20 smart contract is shown below:

contract TOKENERC20 is owned {using SafeMath for uint256;

// Public variables of the token

/* This generates a public event on the blockchain that will notify clients */

event Approval(address indexed _owner, address indexed _spender, uint256 _value);

string public name;
string public symbol;
uint8 public decimals = 18;
uint256 public totalSupply;

uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) public {

totalSupply = initialSupply * 10 ** uint256(decimals); // Update total supply with the decimal amount
balanceOf[msg.sender] = totalSupply; // Give the creator all initial tokens
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes

// This creates an array with all balances
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) private _allowance;
mapping (address => bool) public LockList;
mapping (address => uint256) public LockedTokens;

// This generates a public event on the blockchain that will notify clients
event Transfer(address indexed from, address indexed to, uint256 value);

// This notifies clients about the amount burnt
event Burn(address indexed from, uint256 value);

/* Internal transfer, only can be called by this contract */
function _transfer(address _from, address _to, uint256 _value) internal {
uint256 stage;

require(_from != address(0), “ERC20: transfer from the zero address”);
require(_to != address(0), “ERC20: transfer to the zero address”); // Prevent transfer to 0x0 address. Use burn() instead

require (LockList[msg.sender] == false,”ERC20: Caller Locked !”); // Check if msg.sender is locked or not
require (LockList[_from] == false, “ERC20: Sender Locked !”);
require (LockList[_to] == false,”ERC20: Recipient Locked !”);

// Check if sender balance is locked
stage = balanceOf[_from].sub(_value, “ERC20: transfer amount exceeds balance”);
require (stage >= LockedTokens[_from],”ERC20: transfer amount exceeds Senders Locked Amount”);

//Deduct and add balance
balanceOf[_from] = stage;
balanceOf[_to] = balanceOf[_to].add(_value,”ERC20: Addition overflow”);

//emit Transfer event
emit Transfer(_from, _to, _value);


2 Logging Event Rules

The logging event functions are also part of the general set of rules of the ERC20 protocol. The 2 logging event rules are Transfer and Approval.

Storing and Trading ERC20

In storing cryptocurrencies, traders use exchanges and online trading platforms. But several hacks in exchanges and trading platforms caused them to lose many of their crypto assets.

For example, in 2017, scammers stole from unsuspecting victims roughly $5 million in Bitcoin. But in the first quarter of 2020, the frequency of scams was nearly 5 times, with the amount stolen a total of $24 million.

In order to keep assets safe, crypto tokens must be stored on a secure crypto wallet.

Millions of people use Ethereum wallets. Unlike traditional pocket wallets, Ethereum wallets don’t store currency. In fact, no single location stores Ethereum. In the same way that it does not have any physical form. They exist as records of transactions stored on the blockchain.

Users exchange ERC20 tokens through the Ethereum blockchain. Accordingly, Ethereum wallets enable the storage and transfer of tokens to other compatible wallets.

There are several types of wallets: online wallets, desktop wallets, and mobile wallets. Good examples of these wallets include MyEtherWallet, Parity, and Trust Wallet.

Other Ethereum Standards

Aside from the ERC-20 standard, there are also other alternatives that exist. In fact, there is a long list of proposed ERC standards. But these three are the ones that are most popular among them all.

ERC-223 Standard

In ERC-20, it is possible for users to lose their tokens when they send to the smart contract by mistake, instead of the correct wallet address.

Based on the ERC-20 standard, ERC-223 addresses this flaw.

The efficiency of transferring the tokens also has been improved, as the ERC223 token only requires half the gas cost of an ERC20 token. Currently, most Ethereum wallets still do not offer support for ERC-223, making the adoption of the newer standard slower than expected.

ERC-721 Standard

Unlike ERC-20, ERC-721 standards have the ability to develop non-fungible tokens (NFTs), which means each token has a different value in the system. Developers tokenize assets of different values through ERC721.

Digital artists can use ERC721 tokens to protect their original work from unauthorized copies. Artists are able to tokenize digital work with ERC721 tokens, creating a cryptographic scarcity and protecting its value.

In order to ease provenance studies and facilitate sales several startups such as Maecenas and Artory are already tokenizing physical art. Ethereum-based collectible game Cryptokitties is one of the most famous examples of Dapps that use the ERC-721 standard.

ERC-777 Standard

This token standard proposes more ways to improve blockchain usability and adds more functions to the ERC-20 standard. Without a doubt, one of the most innovative features is the option to mint or burn tokens.

The ERC-777 standard uses an advanced transaction handling method from which all applications on the ERC-20 standard can benefit from. Like other ERC token standards, a few projects have actually decided to implement the protocol.

However, its adoption has been relatively slow and there are no well-known projects that utilize the said standard.

ERC20 Flaws

One of the flaws of ERC20 is with smart contracts. If a smart contract that doesn’t support the ERC-20 standard will not reject the transaction, the token will be frozen or lost as a result.

The transaction will be considered completed only if the token has been transferred successfully.

Creating a token in ERC-20 is very simple. As a result, useless and scammy tokens flood the crypto market.

ERC20 is still the preferred standard

Among the ERC token standards mentioned above, many developers still choose ERC-20 as their preferred standard because:

  • Using different standards may lead to higher network effects
  • Token developers have criminal irresponsibility for their misdeeds
  • The Ethereum Foundation still promotes the ERC-20 standard even though it contains some bugs
  • The main reason for token development is to grab funds, rather than to create products

Future of ERC20

While ERC20 tokens are important for the growth of the crypto ecosystem, some people suggest that they may have outstayed their welcome. Indeed, people have already started to experiment with newer standards like ERC-223, ERC-721, ERC-777, etc.

But as of now, ERC20 is not going to disappear.

Change is slow and it would take some time before the Ethereum community can move and use other options as their preferred standards.

However, the ERC-20 standard has its own uses today. After all, it wouldn’t be the preferred option today if it is not the best.

Read More: In CoinQuora’s Ethereum 101 section, we discuss more topics regarding Ethereum.

Ananthi Reeta

Crypto trading has enticed Ananthi to write for CoinQuora. She has made it her personal mission to teach people about cryptocurrency and to simplify the terms for non-geeks to understand with ease.

Related Articles

Back to top button