Token standard – the difference between ERC20 and ERC223
Any startup or mature company planning an initial coin offering will face the matter of token development sooner or later. There is no ICO without tokens, thus a proper token issuance and management is a necessary part of any ICO.
Whether you are developing your ICO platform in-house or hire a professional team to develop it for you, the issue of the token standard is sure to come up. Most ICOs are built on top of the Ethereum blockchain, as it provides the most optimal environment for running an ICO. Therefore, the token you need should belong to one of the Ethereum token standards.
A quick search will return a couple dozen Ethereum token standards, however, you will soon notice that the ones mentioned the most frequently are ERC20 and ERC223. If you browse our blockchain development page, you will also see the reference to ERC20 and ERC223. So, let’s look closer at these token standards and find out why you should choose one or the other.
What is token standard?
In order to be accepted by the Ethereum platform, the token should comply with a set of rules. These rules are formalized in the token standard that specifies a set of commands that the token must perform on the Ethereum platform.
By developing the token according to a particular standard, you ensure that the token will perform according to the Ethereum procedures and can be traded after launch. All Ethereum tokens have the ERC prefix which stands for “Ethereum Request for Comment”. The number in the standard name refers to its version.
ERC20 token standard
ERC20 is the most popular token standard so far. It was first introduced in 2015 and was used in the majority of ICOs launched in 2017. ERC20 tokens are used by such well-known projects as EOS and Bancor.
Generally, ERC20 is a specification that the developers creating a new ICO should implement to get an Ethereum-compatible token. The introduction of a standard streamlined the token development, as it determined the basic set of functions with the same names and arguments. The basic functions that any ERC20 token performs are as follows:
- totalSupply – returns the total supply of tokens
- balanceOf – returns the token balance on the specified account
- transfer – transfers the specified number of tokens to the specified address
- transferFrom – transfers the specified number of tokens from one specified address to another
- approve – allows withdrawal of the specified number of tokens from the specified account
- allowance – returns the remaining balance of tokens that can be withdrawn from the specified account by the spender.
Such unification simplifies token exchange because any token compliant with the ERC20 standard can be easily traded on the same platform.
In a way, the implementation of ERC20 was a revolutionary step in the development of ICOs. Thousands of ERC20 tokens have been developed so far. However, the ERC20 standard, for all its advantages, was not perfect. It contained one major bug that made developers look for improvements.
The problem of ERC20 tokens was rather critical and concerned the functions used to transfer tokens between accounts. As you can see from the list of functions above, the ERC20 standard supports two ways of sending tokens – by using the transfer or approve + transferFrom functions.
If you want to send tokens to somebody else’s wallet address, the function to use is transfer. It adjusts your balance and your counterparty’s balance for the number of tokens you are sending. However, this function does not work when you want to deposit your tokens on a smart contract. Or, should we say, it works, but not the way you expect it to.
If you use the transfer function to send tokens to a smart contract, the transaction will appear successful. However, the smart contract will not be able to credit the received tokens to your account. To make the matters worse, if the smart contract has no emergency withdrawal feature, you will not be able to return your tokens. In this case, they will be lost forever.
For ERC20 tokens, the correct procedure of smart contract deposits is using two functions – approve + transferFrom. The approve function permits the smart contract to debit your account. Then, the transferFrom function will transfer the tokens from your account to the smart contract.
The main problem of ERC20 was that it is not immediately obvious which transaction to use with smart contracts, therefore, there are already millions of dollars lost in tokens deposited with the transfer functions. At the same time, performing two transactions instead of one doubles the cost and increases the processing time.
This problem is what the ERC223 standard was meant to resolve.
Basically, ERC223 is a superset of ERC20 containing all of its same functionality. ERC223 is backward compatible with ERC20, thus, any platform working with ERC20 will also work with ERC223.
However, its major difference is that in ERC223 the transfer function has an additional parameter checking whether the destination address is a smart contract. If so, the transaction triggers the tokenFallback function in the smart contract. This function can return the tokens to the sender’s account. After that, the tokens are transferred to the smart contract.
However, for this procedure to work properly, the developers of the smart contract should implement the tokenFallback function. If the function is included, the transaction is successful. Otherwise, it fails.
Benefits of the ERC223 standard
The ERC223 token standard has lived up to the expectations and managed to take care of the problem of ERC20. Summing up, the benefits of the ERC223 token standard are as follows:
- No tokens are lost. With the updated transfer function now working for smart contracts, too, users can follow the same token transfer instructions both for wallets and smart contracts, and no tokens will be lost anymore.
- Smart contract developers can reject incoming tokens of unsupported types. Previously, such tokens were lost, while with the implementation of ERC223, this problem no longer exists.
- Transactions are less expensive. Since the ERC223 standard allows sending tokens to smart contracts in one transaction instead of two, the transfer requires less energy. Therefore, the transaction fee for the sender is lower.
Which token standard to choose for your ICO?
ERC20 is still very popular and familiar to token and smart contract developers. However, we recommend choosing ERC223 for your ICO. It will immediately clear the problems for your users and help them save transaction costs.
If you do choose the ERC20 standard, make sure to include crystal-clear instructions on the transfer flow, so that the users do not lose their tokens.
We will be happy to consult you about the best token and smart contract format for your particular project. Contact us and describe your idea of the ICO. Together we can work out the best ICO strategy from the platform development to marketing and promotion.