What is the ERC-20 standard?

What is the ERC-20 standard?

17
1870

Written by Tieu Truong

In Ethereum, ERC stands for Ethereum Request for Comments, which is often confused with Ethereum Improvement Proposals (EIPs), which are proposals for improving the Ethereum network. In reality, ERCs are technical documents outlining standards for programming on Ethereum, aiming to facilitate interaction between applications and smart contracts.

In 2015, Vitalik Buterin and Fabian Vogelsteller proposed ERC-20, a relatively simple format for token contracts operating on Ethereum. Developers no longer need to reinvent different structures and can leverage this existing standard to create fungible tokens.

Source: Ethereum

Token: “Blockchain’s most powerful and most misunderstood tool”

First and foremost, we need to clarify the two most confusing concepts: Token Contract and Token.

A Token Contract is simply a smart contract on Ethereum. Once deployed, it is responsible for updating data about the tokens it has created.

On the other hand, a Token represents something on Ethereum. It could be a fiat currency, company shares, voting rights, lottery tickets, in-game experience points, or anything else. By representing everything as tokens, we enable smart contracts to interact, exchange, create, or destroy them.

However, unlike ETH, our accounts do not actually hold ERC-20 Tokens. These tokens exist only within the corresponding ERC-20 Token Contract and act as a separate database mapping users’ Ethereum addresses to their balances. When we say someone holds tokens, it means their balance in that token contract is not zero. Similarly, when we execute a token transfer command, we are actually requesting the token contract to decrease our balance while simultaneously increasing the recipient’s balance by an equivalent amount.

Source: LUKSO

How are ERC-20 token contracts created?

Based on Vitalik and Fabian’s proposed improvement in 2015, token contracts following the ERC-20 standard are composed of nine functions, including six mandatory functions and three optional functions.

Mandatory Functions

  • totalSupply(): Returns the total supply of tokens.
  • balanceOf(account): Retrieves the token balance of a specific wallet address.
  • transfer(recipient, amount): Transfers the sender’s tokens to another wallet address. Note: It is possible to transfer 0 tokens.
  • approve(spender, amount): Limits the number of tokens a smart contract can withdraw from the sender’s account.
  • allowance(owner, spender): Represents the remaining tokens that a smart contract is allowed to withdraw from the owner’s account. By default, it is set to 0 and only changes when approving or transferFrom functions are executed.
  • transferFrom(sender, recipient, amount): Allows a smart contract to transfer tokens from one wallet address to another on behalf of the owner using the allowance mechanism.
Source: Consensys

Optional Functions

  • constructor(name, symbol, decimals): Sets the values for name, symbol, and decimals. They can only be set once and cannot be changed thereafter.
  • name(): Retrieves the name of the token. For example: Ethereum.
  • symbol(): Retrieves the symbol of the token, usually consisting of 3 characters. For example: ETH.
  • decimals(): Retrieves the number of decimal places, typically set to 18, based on the relationship between Ether and Wei.
Source: Consensys

In reality, there are many ERC-20-compliant contracts that go beyond the nine standard functions and include additional features not included in the original standard to meet their specific needs. Some examples of these additional features are:

  • mint(account, amount): Generates additional tokens.
  • burn(amount): Destroys a certain amount of tokens.
  • increaseAllowance(spender, addedValue): Increases the number of tokens that a smart contract can withdraw from its account.
  • decreaseAllowance(spender, subtractedValue): Decreases the number of tokens that a smart contract can withdraw from its account.

Furthermore, there are functions related to TokenVesting, which automate the token issuance and allocation process.

What can ERC-20 tokens do?

Real-World Asset Tokenization

ERC-20 enables the conversion of undifferentiated ownership rights of real-world assets into tokens stored on the blockchain. These tokens represent the underlying assets and can be used to track and transfer ownership. These assets can include currencies, precious metals (gold, silver), stocks, bonds, oil, and more.

Source: Chainlink

Fiat-backed Stablecoins

Typically, organizations issuing stablecoins will hold and manage reserves of fiat currency or equivalent cash-like assets. For each unit in the reserve, they will then issue a token. For example, if there is a reserve of $10,000, the issuing organization can create up to 10,000 tokens, with each token being exchangeable for $1.

Source: Nuant

Algorithmic Stablecoins

Unlike Fiat-backed Stablecoins, Algorithmic Stablecoins are not fully backed by reserves but rather rely on algorithms and mechanisms implemented on the blockchain to maintain price stability.

Source: HashKey Group

Crypto-backed Stablecoins

Crypto-backed Stablecoins are stablecoins that are backed by other cryptocurrencies. They are often overcollateralized to absorb price fluctuations in the market.

Security Tokens

Security Tokens are digital representations of traditional investment instruments such as stocks, bonds, or other securitized assets.

Utility Tokens

Unlike the tokens mentioned above, Utility Tokens are not backed by any underlying assets. They are created to provide owners with some utility or function within a project or ecosystem (voting rights, in-game currency, customer loyalty rewards, and more).

References

ERC 20 (no date) OpenZeppelin Docs. Available at: https://docs.openzeppelin.com/contracts/2.x/api/token/erc20 (Accessed: 09 August 2023).

Fabian Vogelsteller, V.B. (2015) ERC-20: Token standard, Ethereum Improvement Proposals. Available at: https://eips.ethereum.org/EIPS/eip-20 (Accessed: 09 August 2023).

Let’s talk about the coin standard (no date) Reddit. Available at: https://www.reddit.com/r/ethereum/comments/3n8fkn/lets_talk_about_the_coin_standard/ (Accessed: 09 August 2023).

Binance Academy (2022) An introduction to ERC-20 tokens, Binance Academy. Available at: https://academy.binance.com/en/articles/an-introduction-to-erc-20-tokens (Accessed: 09 August 2023).

Chainlink (2023) How to tokenize an asset: Chainlink, Chainlink Blog. Available at: https://blog.chain.link/how-to-tokenize-an-asset/ (Accessed: 09 August 2023).

Majaski, C. (2023) Cryptocurrency security token: Definition, forms, investing in, Investopedia. Available at: https://www.investopedia.com/terms/s/security-token.asp (Accessed: 09 August 2023).

Genç, E. (2023) Algorithmic stablecoins: What they are and how they can go terribly wrong, CoinDesk Latest Headlines RSS. Available at: https://www.coindesk.com/learn/algorithmic-stablecoins-what-they-are-and-how-they-can-go-terribly-wrong/ (Accessed: 09 August 2023).

17 COMMENTS

Comments are closed.