ERC-20

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

ERC-20 is a technical standard used for smart contracts on the Ethereum blockchain for implementing tokens.[1][non-primary source needed] The majority of tokens issued on the Ethereum blockchain are ERC-20 compliant.[1][failed verification] As of August 25, 2019, a total of 208,165 ERC-20 compatible tokens are found on Ethereum main network.[2]

ERC-20 defines a common list of rules for Ethereum tokens to follow within the larger Ethereum ecosystem, allowing developers to accurately predict interaction between tokens. These rules include how the tokens are transferred between addresses and how data within each token is accessed.[3]

History[edit]

ERC-20 was proposed on November 19, 2015, by Fabian Vogelsteller.[4] It defines a common list of rules that an Ethereum token has to implement, giving developers the ability to program how new tokens will function within the Ethereum ecosystem.

ERC is an acronym for Ethereum Request for Comment, and 20 is the number that was assigned to the standard.

Applications[edit]

As of August 25, 2019, there were 208,165 ERC-20 token contracts on the Ethereum blockchain, according to Etherscan.io.[5]

Wrapped ether[edit]

Ethereum's native token, ether, does not conform to the ERC-20 standard. To enable the ability to use ether on platforms requiring ERC-20 compliance, users can convert ether to a "wrapped" token, commonly known as "WETH".[6][7] The wrapped tokens are held in a smart contract which maintains a 1:1 peg to ether.[8]

Technical standard[edit]

The ERC-20 token standard has the following method-related functions:[1]

The specific wording of the function is followed by a clarification of what it does, in square brackets.

  1. totalSupply() public view returns (uint256 totalSupply) [Get the total token supply]
  2. balanceOf(address _owner) public view returns (uint256 balance) [Get the account balance of another account with address _owner]
  3. transfer(address _to, uint256 _value) public returns (bool success) [Send _value amount of tokens to address _to]
  4. transferFrom(address _from, address _to, uint256 _value) public returns (bool success)[Send _value amount of tokens from address _from to address _to]
  5. approve(address _spender, uint256 _value) public returns (bool success) [Allow _spender to withdraw from your account, multiple times, up to the _value amount. If this function is called again it overwrites the current allowance with _value]
  6. allowance(address _owner, address _spender) public view returns (uint256 remaining) [Returns the amount which _spender is still allowed to withdraw from _owner]

Events format:

  1. Transfer(address indexed _from, address indexed _to, uint256 _value). [Triggered when tokens are transferred.]
  2. Approval(address indexed _owner, address indexed _spender, uint256 _value)[Triggered whenever approve(address _spender, uint256 _value) is called.]

References[edit]

  1. ^ a b c "ERC-20 Token Standard - The Ethereum Wiki". Theethereum.wiki. Retrieved 17 August 2017.
  2. ^ etherscan.io. "Etherscan Token Tracker Page". etherscan.io. Retrieved 2019-08-25.
  3. ^ Reiff, Nathan (2017-06-20). "What is ERC-20 and What Does it Mean for Ethereum?". Investopedia. Retrieved 2018-04-27.
  4. ^ "ERC: Token standard #20". Github.com. Retrieved 13 April 2018.
  5. ^ etherscan.io. "Etherscan Token Tracker Page". etherscan.io. Retrieved 2019-08-25.
  6. ^ "Canonical WETH – 0x Protocol". 0x Protocol. 2017-11-08. Retrieved 2018-09-03.
  7. ^ "W-ETH". weth.io. Retrieved 2018-09-03.
  8. ^ etherscan.io. "Ethereum Accounts, Address and Contracts". etherscan.io. Retrieved 2018-09-03.