ERC-20

What is ERC-20?

Similar to , ERC-20 is a standard for creating and issuing tokens on the Ethereum blockchain. It defines a set of rules that Ethereum tokens must follow, facilitating their exchange and transfer.

ERC-20 Standard

The ERC-20 standard defines the interface for tokens on the Ethereum blockchain. It includes the following methods:

  • totalSupply() -> uint256 - Returns the total supply.
  • balanceOf(account: address) -> uint256 - Returns the token balance of a specific account.
  • transfer(to: address, amount: uint256) -> bool - Transfers tokens to a specified .
  • approve(spender: address, amount: uint256) -> bool - Allows a spender to withdraw a specific amount of tokens.
  • transferFrom(from: address, to: address, amount: uint256) -> bool - Transfers tokens between two addresses.
  • allowance(owner: address, spender: address) -> uint256 - Returns the remaining number of tokens that the spender will be allowed to spend on behalf of the owner.

It also defines two events:

  • Transfer(from: address, to: address, value: uint256) - Emitted when tokens are transferred.
  • Approval(owner: address, spender: address, value: uint256) - Emitted when the approval function is called.

The names and signatures of these methods and events are critical and must follow the standard precisely.