ERC token standards

ERC token standards

ERC

ERC or the Ethereum Request for Comments authored by Ethereum community developers in forms of a memorandum describing the behaviour, methods, and research application to work in an Ethereum ecosystem. Often times submitted by peer reviews or simply to convey a new concept or information regarding the tokens, once core developers and community approve of it, the proposal can be referred as a standard for Ethereum based tokens. These proposal or standards are a set of functions that should be implemented at the time of smart contract development. Here are the most talked about standards ERC-20, ERC-223, ERC-721 and many more which are waiting for approval.

ERC-20

The ERC-20 standard is the most common and well known token standard in the Ethereum based crypto token community. The tokens in the Ethereum ecosystem which considered digital assets are issued in the blockchain network. The token with ERC-20 compliance means that it can be exchanged for other currencies. The issuer of the token retains complete control of their assets, however with ERC-20 standard it is possible to track who owns the token and how much at any given point of time. So these crypto tokens or cryptocurrencies that comply with ERC-20 standard are deployed in the Ethereum blockchain

The following functions can be accessed under the ERC-20 standards

  • balanceOf(address _owner): returns account balance of _owner’s account
  • totalSupply(): returns total token supply
  • transferFrom(address _from, address _to, uint256 _value): transfers _value amount of tokens from the address _from to the address _to, and triggers the transfer event
  • transfer(address _to, uint256 _value): takes in number _value and transfers that amount of tokens to address _to and triggers transferevent
  • allowance(address _owner, address _spender): returns the amount which the_spender is still allowed to withdraw from the _owner
  • approve(address _spender, uint256 _value): allows _spender to withdraw any number up to _value amount

Based on the aforementioned functions, the below events are triggered

  • approval(address indexed _owner, address indexed _spender, uint256 _value): is triggered on any call to approve()
  • transfer(address indexed _from, address indexed _to, uint256 _value): this is triggered whenever tokens are transferred

ERC-223

ERC-223 standards originally introduced by developers to solve the short comings with the ERC-20 standards; ERC-223 tokens are backward compatible with ERC-20 which means all functions and contracts that work with ERC-20 token would also work with the ERC-223. What ERC-223 brings to the table is that it eliminates the accidental transfer of tokens to an unknown or unaware contract i.e. mistyping the intended address. In that case the transferred tokens would be lost forever. ERC223 allows its users to transfer their tokens to either a wallet or a contract with the similar transfer function, thereby eliminating the potential for any confusion and losing tokens. This proposes an all new transfer method to accomplish the resolve. If in case the receiver is a non-contract address then it would go back to act as like ERC-20;

ERC-721

ERC-721 token is quite different from the regular ERC-223 and ERC-20. It elaborates a non-fungible token which means each token is completely different and each token can have a diverse value to the different users owning it. The best illustration of this would be the Cryptokitties which created quite a stir in 2017. Each one is its own separate unit or commodity’s value is based on its own rarity and the desirability by users. ERC-721 standard tokens could be used in any exchange, but the value of token is “a result of the uniqueness and rareness associated with each token.” The standard functions with ERC-721 are

  • name,
  • symbol,
  • totalSupply,
  • balanceOf,
  • ownerOf,
  • approve,
  • transfer,
  • tokenOfOwnerByIndex
  • tokenMetadata.
It also defines two events: Transfer and Approval