ERC-223 is a proposed standard for tokens on the Ethereum Blockchain. ERC-223 is an improvement, or superset, to the ERC-20 standard. ERC-20, the official token standard for the Ethereum blockchain, was envisioned as a common standard for all tokens on the Ethereum network however a significant shortcoming that has resulted in the loss of tokens necessitates the development of more advanced standards such as ERC-223.
Ethereum is a blockchain-based, decentralized software with its own programming language, Solidity, developed to enable smart contracts and third-party applications to be built on a decentralised blockchain. The Ethereum community created the ERC-20 standard to govern the way that tokens can be used and created by these smart contracts.
The ERC-20 standard contains six mandatory functions and three optional functions for tokens on the Ethereum Blockchain. The “Transfer” function is intended to facilitate transfers from the smart contract address to a user wallet address while combining the “TransferFrom” function and the “Approve” function facilitates transfers from a user wallet to a smart contract. If the “Transfer” function is incorrectly used to transfer tokens from a user address to the smart contract address, the smart contract is unable to handle the incoming tokens and the value will be lost. u/Dexaran, an Ethereum community member discovered the bug and has since proposed the ERC-223 standard as a community response to this problem as well as an improvement in other areas.
Objectives for ERC-223
u/Dexaran and The Ethereum community outline four issues that the ERC-223 aims to correct.
Lost tokens inside smart contracts: ERC-20 contains two functions for transferring tokens. The transfer function is to be used when the receiving address is a user wallet address, while the “TransferFrom” function should be used when the receiving address is a contract address. When the transfer function is used to transfer tokens to a contract address, the tokens will be lost inside the contract.
Inability to handle incoming token transactions: The ERC-20 standard does not require notification to the receiver when a transaction occurs, nor can it reject transactions in unsupported tokens.
ERC-20 token transactions between wallet address and contract require two functions: To transfer tokens from a wallet address to a contract address with ERC-20, you must use both the call “TransferFrom” and “Approve” functions to make the transfer successfully. Because two functions are used, the transaction consumes twice the gas of a single function.
Ether (ETH) transactions and ERC-20 token transactions behave differently: Smart Contracts normally deal with Ether, the Ethereum currency, and smart contract tokens. Where ERC-20 handles most tokens and Ether differently, this presents an unnecessary complication.
The ERC-223 Token Standard
ERC-223 addresses the objects by condensing three of the mandatory functions of ERC-20 into one. This single-function combines the functionality of the ERC-20 functions “Transfer” and “TransferFrom” to prevent user error while also combining the ERC-20 “Approve” function to eliminate the requirement for two functions to be run when transferring tokens from a wallet address to a contract address. To make this combination work, ERC-223 requires that during a transaction, the program checks whether the recipient’s address is either a wallet or a contract and whether the contract can receive the given token. If the token cannot be received, this triggers a safety mechanism which returns the token to the sender. ERC-223 functions behave similarly whether a contract token or Ether token is being transferred.
This approach successfully reduces the gas required to transfer from a user wallet to a smart contract and avoids user error resulting in a token loss. Because ERC-223 combines three of the required functions of ERC-20 into one function, tokens that comply with ERC-223 may be incompatible with ERC-20 smart contracts, which are programmed to require the use of both the “TransferFrom” and “Approve” functions when receiving tokens. Although this means that ERC-223 is not currently backwards compatible with ERC-20 tokens and smart contracts, the Ethereum community continues to work towards the interoperability of the two standards.