The ever evolving Ethereum Blockchain brought to Cryptocurrency and ICO investors a new gift, the ERC223 a new standard for tokens created on Ethereum. Up 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 the investors for that token. ERC20 makes sure the behavior of the token on Ethereum is standard with a defined common list of rules. The ERC223 is an improvement of ERC20 protocol, and is backwards compatible to ERC20, meaning every wallet and software that supports ERC20 does work with ERC223. So to get a better picture from this improvement, maybe its better to breakdown how these tokens are created and lets start with the ERC20 tokens.
ERC20 and how does 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 now very popular, specially 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 is done smoothly
A token is compliance with ERC20 if the developer of the token contract implement the following interfaces:
- The token name with function name, it returns the name of the token.
- The token symbol with function symbol, it returns the symbol that token will use.
- The token decimal places, function that returns the unit8 decimals the token uses.
- How much the owner want to start off with: function balanceOf, it returns the account balance.
- The amount 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 token holder 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 has added to ERC20 and what are the advantages?
Initially the idea of ERC223 came to play when the amount of lost tokens on Ethereum Blockchain went sky rocketing, this was due to lack of possibility to handle incoming transactions. Ethereum Blockchain is a leading network for number of lost tokens. 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 tokens, the contract will not reject the tokens because the contract does not recognize an incoming transaction. Consequently the token will get stuck the that contract balance. ERC223 will allow users to only send their tokens to either wallet or contracts with the same transfer function, this way it prevents the loosing of the token. ERC223 introduces the function transfer (address _to, unit _value, bytes _data). This function transfers tokens with invoking the function tokenFallback in _to, only if _to is a contract. This will allow the smart contract to actively handle sent tokens. 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 contract are two different transactions. There two functions need to be triggered, first the approve function on the token contract and latter the transferForm on the other contract (the receiver). ERC223 has addressed this more efficiently by allowing to use 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 address of a wallet 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 comes 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 contract in a way that only works with some specific tokens incoming and handling them in a specific way which could also each tokens could be handled in a specific way.
- ERC223 consumes almost half gas as ERC20
Currently is not possible to upgrade existing ERC20 token contract to ERC223, but if you are planning to create your own maybe its a good idea to go with ERC223.