ERC20 Tokens: A Complete Guide

ERC20 is a standard that allows developers to build their cryptocurrencies on the Ethereum network. It has made it easier for businesses to establish their blockchain services rather than creating their own blockchain starting from scratch. Startups are benefiting from the ERC20 token. Many companies have also raised millions of dollars through token sales. EOS, Tron, and VeChain were first released as ERC20 tokens and have been converted to their mainnets.

Summary (TL;DR)

  • History: It was proposed in 2015 by Vitalik Buterin and Fabian Vogelsteller. In EIP-20, they specified a standard interface for tokens. Here is the link to original proposal by Vitalik Buterin and Reddit discussion.
  • Full Form: ERC-20 stands for Ethereum Request for Comment, the network’s official protocol for suggesting improvements. 20 is the proposal’s identifier, which serves as a unique token standard for Ethereum-based tokens.
  • Representation: They can represent almost anything like points on an online platform, a character’s skills in a game, lottery tickets, stock in a firm, a fiat currency, or an ounce of gold.
  • Fungibility: Each Token is identical in type and value to every other Token. An ERC-20 Token functions similarly to ETH where one Token is and will always be equal to all other Tokens.
  • Goal: The following standard enables creating a common API for tokens within smart contracts with basic functionality for transferring tokens and approving tokens so that another on-chain third party can spend them.
  • Protocol: It is not a piece of software or code but a standard protocol, similar to HTTP. It regulates tokenization and guarantees that the tokens technical specifications are met. If a token does not satisfy standards, it will not be referred to be an ERC20 token. If it does, it is referred to as an ERC20 token.
  • Blockchain: Blockchain is not required for all tokens that are generated. Instead, they can thrive on the Ethereum blockchain.
  • Smart contracts: Each token function is regulated by a set of smart contracts, guaranteeing that no person or entity is required to be trusted for the crypto token to work. When certain conditions, the code executes automatically.
  • Mining: Tokens cannot be mined. When a contract is launched, the supply is distributed according to the organization’s plans and roadmap through an ICO, an IEO, or a STO.
  • Choosing: On the Ethereum blockchain, there are over 200,000 ERC-20-compatible tokens, however only 2,600 of these ERC-20 tokens are tradable. As 80% of them are merely test tokens for development with only a few documented transfers. A token must have a business model and value in order to be listed on an exchange. Blockchain explorers like Ethplorer let us follow all of the activity surrounding these tokens.

ERC20 Standard Rules

If a smart contract wants to use the ERC20 token, it must adhere to certain criteria called ERC standards. In other situations, if we do not follow these conditions, it will not be appropriate to call it an ERC 20 token. There are 9 rules, 6 of which are required and 3 of which are optional.

Erc20 Tokens: A Complete Guide

Mandatory Rules

1. TotalSupply

  • Purpose: It returns total token supply.
  • Declaration: function totalSupply() public view returns (uint256)
Totalsupply
TotalSupply

2. BalanceOf

  • Purpose: It returns the number of tokens that a specific address.
  • Declaration: function balanceOf(address _owner) public view returns (uint256 balance)
Balanceof
BalanceOf

3. Transfer

  • Purpose: It transfers our tokens to another address.
  • Declaration: function transfer(address _to, uint256 _value) public returns (bool success)
Transfer
Transfer

4. TransferFrom

  • Purpose: It allows contracts to transfer tokens on our behalf.
  • Declaration: function transfer From(address _from, address _to, uint256 _value) public returns (bool success)
Transferfrom
TransferFrom

5. Approve

  • Purpose: We can limit the number of tokens that a smart contract can withdraw from our balance.
  • Declaration: function approve(address _spender, uint256 _value) public returns (bool success)
Approve
Approve

6. Allowance

  • Purpose: It returns the amount of tokens we can still withdraw from our account.
  • Declaration:

function allowance(address _owner, address _spender) public view returns (uint256 remaining)

Optional Rules

1. Token Name:

  • Need: It is not required to name tokens, but it is essential to give them a unique identification.
  • Declaration: string public constant name = “Token Name”;
  • Example: DogeCoin, Shiba INU Coin all are benefitted by their names.

2. Decimal

  • Need: Divisibility assists us in determining the token’s lowest value. Divisibility of 0 indicates that the token’s lowest value is 1 whereas 2 indicates that its lowest value will be 0.01. The maximum number of decimal places allowed is 18.
  • Declaration: uint8 public constant decimals = 18;
  • Example: If we take the case of Tether. People are far more familiar with USDT.

3. Symbol

  • Need: A catchy symbol helps with better branding.
  • Declaration: string public constant symbol = “SYM”; 
  • Example: Tokens used as currency can benefit more from being more divisible.

If a Smart Contract implements the following rules, it is referred to as an ERC-20 Token Contract. It will be responsible for keeping track of the generated tokens on Ethereum once deployed.

Trading

In this section, we will understand how to trade ERC-20 tokens.

ERC20 Wallets

  • Need: These are digital wallets that will hold all of our tokens, and we use an ERC20 wallet to connect to other platforms to buy and sell things.
  • Before creating an account in the wallet, we must ensure that the ERC20 wallet accepts our token.
  • Examples: MyEtherWallet, MetaMask, Trust Wallet, and Coinbase Wallet are a few examples.
  • Address: ERC20 wallet address is an Ethereum address. All Ethereum addresses are capable of holding ERC20 tokens. Ethereum blockchain is connected to all Ethereum wallets. Select a wallet that accepts other types of tokens. It will provide us with the opportunity to exchange our tokens with other tokens.

Sending Tokens

  • By copying the recipient’s Ethereum wallet address, we can send ERC-20 tokens.
  • Gas costs are an important factor to consider while transferring ERC-20 tokens. These are transaction fees paid by users to miners for their transactions to be included in the blockchain.

Receiving Tokens

  • Check that our wallet not only supports ERC-20 tokens but also lists the specific token we want to receive.

Implementations

On the Ethereum network, there are currently a plethora of ERC20-compliant tokens in use. In addition, various teams have created alternative implementations with varying features, ranging from gas savings to enhanced security. OpenZeppelin Implementation and ConsenSys Implementation are major examples.

Major Projects

In this section, we will understand the major projects which use ERC-20 tokens.

USDC

  • It is a stablecoin pegged to the US dollar at a 1:1 ratio.
  • The goal is to build an ecosystem accepted by as many wallets, exchanges, service providers, and dApps as possible.
Usdc
USDC

Dai

  • It is a stablecoin whose issuance and development is done by the Maker Protocol and the MakerDAO.
  • The price is pegged to the U.S. dollar and is collateralized by a mix of other cryptocurrencies deposited into smart contracts.

Chainlink

  • It is a decentralized blockchain oracle network.
  • The network is designed to make it easier to move tamper-proof data from off-chain sources to on-chain smart contracts.

Wrapped Bitcoin

  • It is a tokenized version of the Bitcoin (BTC) blockchain that operates on the Ethereum (ETH) network.
  • It is backed by Bitcoin in a 1:1 ratio, allowing users to transfer liquidity across the BTC and ETH networks.

USDT

  • It is a stablecoin that is pegged with the price of the US dollar.
  • The goal is to combine the nature of cryptocurrencies that can be transferred between users without a middleman with the stable value of the US dollar.

Applications

The versatility of ERC-20 tokens is a crucial element of their attraction. In this section, we will understand the applications of ERC-20 tokens.

Stablecoins

  • Definition: Cryptocurrencies that peg their market value to an external reference.
  • Example: In a fiat-backed stablecoin, an issuer keeps reserves of euros, dollars, and other fiat currencies. Then they issue a token for each unit in their reserve. This implies that if $1000 is kept in a vault, the issuer can produce 1000 tokens, each redeemable for $1. The tokens will then be distributed to users with the promise that these can subsequently be redeemed for a comparable quantity of fiat currency.

Security Tokens

  • Definition: A security token is a token that reflects a stake in an external company or asset.
  • Uses: They represent stocks, bonds, or physical assets.
  • Voting: Tokens can be used to vote on project decisions. In this case, the more tokens a user has, the more power they have.

Utility Tokens

  • Definition: A utility token is a token that aids in the capitalization or funding of initiatives for startups, businesses, or project development organizations.
  • Uses: They are used as in-game currency, fuel for decentralized apps, loyalty points, and many other things.
  • Crowdfunding: Developers can choose to raise funds for their applications through crowdfunding. In exchange, investors receive newly created tokens at pre-determined rates before the official launch.

Advantages

In this section, we will understand the advantages of ERC-20 tokens.

1. No Need to Start from Scratch

  • Problems in Creating Smart Contracts: They are essential in defining the overall supply of the token, how that supply is distributed, the issuance schedule, and so on. Writing these smart contracts is a time-consuming and challenging procedure that generally requires a team of professional developers. This can be highly costly and have disastrous consequences if the smart contracts are not correctly written.
  • Problems in Listing on Wallets and Exchanges: Creating tokens without using a standard like the ERC-20 framework demands more effort to make them interoperable with third-party services like wallets and exchange platforms.
  • Solutions: Everything is already defined in ERC-20 Standards. Therefore, one should only follow the steps carefully without errors.

2. Easy Procedure

  • There is a standard procedure that must be maintained and followed. It would have been an interoperability risk if everyone had created their tokens with their functionalities. Storing such tokens in wallets and listing them on exchanges would have been inconvenient.

3. Proper Rules and Regulations

  • ERC20 token Standard provides a clear path for developers to follow. Instead of starting from scratch, it is much easier for them to come up with tokens.

4. Fungibility

  • Since each unit can be exchanged for another.

5. Flexibility

  • They can be customized for a wide range of uses. For example, They can be used as in-game currencies, rewards programs, digital collectibles, art representation and property rights.

6. Risk-Free

  • Smart Contracts: Transactions are risk-free due to smart contracts.
  • Open-Source: All the code is open-source, leading to complete transparency.

7. High Liquidity

  • If the projects built on top of Ethereum are active and engaging with one another, it will ultimately attract additional projects and users to the Ethereum network, increasing liquidity.

Disadvantages

In this section, we will understand the disadvantages of ERC-20 tokens.

1. Scalability

  • Problem: Ethereum does not scale effectively in its current state, resulting in high costs and delays when the network is congested. If we launch an ERC-20 token and the network becomes crowded, the token suffers the same problem.
  • Solution: The community intends to fix these issues using Ethereum 2.0.

2. transfer() bug

  • Types of accounts in Ethereum:
  1. Externally Owned Accounts (EOA): They are managed by a private key.
  2. Contract Accounts: They are controlled by their contract code.
  • Transferring Tokens:
  1. To another EOA account: We use the transfer() function to transfer the tokens.
  2. To another Contract account: We use the transfer() function to transfer the tokens.
  • Problem in Transferring to Contract account: But here we encounter a problem resulting in the loss of almost millions of dollars. The main issue with the transfer() function here is that even after it is called, the receiver is not alerted of the transfer, even if the transaction is successful.
  • approval() and transferFrom() Combination: We can use this Combination to encounter above problem.
  • Problem in approval() and transferFrom() Combination: It is an insecure operation, leading to double-spent.

3. Low Entry Point

  • Anyone can create: ERC20 has made it far too simple for anyone to create their tokens. There are no restrictions.
  • Scam: As a result, many people are producing unnecessary tokens that are flooding the market and, in many cases, creating bogus tokens to raise money.

Conclusion

For years, the ERC-20 standard has dominated the crypto industry and played an essential role in driving cryptocurrencies into the mainstream. Anyone can develop an ERC20 token using a smart contract and publish it on the blockchain. As a result, it is one of the most influential blockchain protocols.

Frequently Asked Questions

Can anyone create ERC-20 Tokens?

  • Yes, anyone can create ERC-20 Tokens ERC20 has made it too simple for anyone to create their tokens. There are no restrictions.
  • Do we need to pay gas fees while doing ERC-20 transactions?

  • Yes, we need to pay gas fees while doing ERC-20 transactions. Gas costs are an essential factor to consider while transferring ERC-20 tokens. These are transaction fees paid by users to miners for their transactions to be included in the blockchain.
  • Are ERC-20 tokens fungible?

  • Yes, ERC-20 tokens are fungible. One Token is and will always be equal to all other Tokens.
  • Can any crypto wallet work for ERC-2O tokens?

  • No, not all crypto wallet works for ERC-2O tokens. Before creating an account in the wallet, we must ensure that the ERC20 wallet accepts our token.
  • Can we mine ERC-20 tokens?

  • No, we cannot mine ERC-20 tokens.
  • Also Read,

    Default image
    Yash Kamal Chaturvedi

    Btech Computer Science, Maharshi Dayanand University, Rohtak (2023)

    Can’t find what you’re looking for? Type below and hit enter!