The evolution in ERC20 and the era of ERC223
The ever-evolving Ethereum Blockchain brought to Cryptocurrency and ICO investors a new gift, the ERC223, a new standard for tokens created on Ethereum. Until now, the newly created tokens on Ethereum public Blockchain should have followed the ERC20 convention. This, by all means, was a huge success and relief for both token owners and investors of that token. ERC20 makes sure the behavior of the token on Ethereum is standard with a defined typical list of rules. The ERC223 is an improvement of the ERC20 protocol and is backward compatible with ERC20, meaning every wallet and software that supports ERC20 works with ERC223. So to get a better picture of this improvement, maybe it’s better to break down how these tokens are created, and let’s start with the ERC20 tokens.
ERC20 and how do such tokens are created?
ERC20 protocol allows token owners and developers to create a token that complies with common, essential behavioral rules. The standard is popular now, especially among ICO investors and their communities. Thanks to ERC20, investors can be certain that the following statement can be true if the token is ERC20:
- Technically tokens can be accepted by almost all exchanges
- Tokens are transferable, and all Ether wallets will automatically store the newly created tokens
- Transactions using that token are done smoothly
A token is in compliance with ERC20 if the developer of the token contract implements the following interfaces:
- The token name with the function returns the name of the token.
- The token symbol with function symbol, it returns the symbol that the token will use.
- The token decimal places a function that returns the unit8 decimals the token uses.
- How much the owner wants to start off with: function balanceOf, it returns the account balance.
- The number of tokens in circulation: function totalSupply, it returns the total token supply.
- The transfer value: function transfer (address _to, unit256 _value), this function is in charge of the transfer events. the function should revert a transaction if the sending account _from does not have sufficient balance.
- The transfer from: function transferFrom, this function is used for withdrawal workflow, it allows contracts on the Blockchain to transfer tokens on the token holder’s behalf.
- The crediting permission function allowance (address _owner, address _spender), it returns the amount which the buyer (_spender) is allowed to withdraw from the owner (_owner).
- The events: with function transfer (address indexed _from, address indexed _to, unit256 _value) its triggered when a token has been successfully transferred and function approval (address indexed _owner, address indexed _spender, unit 256 _value) this must trigger on any successful call.
What did ERC223 add to ERC20, and what are the advantages?
Initially, the idea of ERC223 came to play when the number of lost tokens on Ethereum Blockchain went skyrocketing, this was due to the lack of possibility to handle incoming transactions. Ethereum Blockchain is a leading network for a number of lost tokens. The top 8 ERC20 contracts with losses will come up to approximately 3 million USD worth of tokens. how does this happen? once an ERC20 token is sent to a contract that is not designed to work with that ERC20 token, the contract will not reject the tokens because the contract does not recognize an incoming transaction. Consequently, the token will get stuck in that contract balance. ERC223 will allow users to only send their tokens to either wallet or contracts with the same transfer function, preventing the token’s loss. ERC223 introduces the function transfer (address _to, unit _value, bytes _data). This function transfers tokens by invoking the function tokenFallback in _to, only if _to is a contract. This will allow the smart contract to handle sent tokens actively. Whereas when an ERC20 token is transferred, the token contract is not notifying the receiver that the transfer has occurred, to that end, the address receiver has no possibility to handle the incoming transaction and, therefore, no way to reject not supported tokens.
A seamless token transfer is another advantage of ERC223 over ERC20. An ERC20 transaction between a regular (not a contract) and a contract are two different transactions. These two functions need to be triggered, first, the approve function on the token contract and later the transferForm on the other contract (the receiver). ERC223 has addressed this more efficiently by allowing to use of the same transfer function. ERC223 could be sent by only calling the transfer function on the token contract with no if the receiver is a regular wallet address or a contract. Due to this shortcut, another advantage that ERC223 has is the gas cost, ERC233 consumes almost half as much as an ERC token.
So as discussed above, ERC223 advantages over ERC20 come down to the following points:
- provides a possibility to prevent accidentally losing tokens
- Allows users to transfer tokens anywhere (owned address or contract) using one function
- allows contract developers to manage incoming transactions, contract developers could implement contracts in a way that only works with some specific incoming tokens and handle them in a specific way which could also each token could be handled in a specific way.
- ERC223 consumes almost half gas as ERC20
Currently is not possible to upgrade the existing ERC20 token contract to ERC223, but if you are planning to create your own, maybe it’s a good idea to go with ERC223.
Learn more about different types of cryptocurrencies. Here you will find an article about the details of the Ethereum blockchain. and Ethereum merge.
Schedule your appointment right now to learn more