Differences between ERC20 and ERC223

While scam tokens and DAO hacks seem to be making daily headline news, there is another more technical financial loss culprit that is not awesome for Ethereum PR.

As of July 2017, about $400,000 worth of tokens have become “lost” on the blockchain because they were sent to a contract not designed to accommodate tokens (Note that this amount was based on the price at the time it was measured).

ERC223 proposes a few improvements that prevent the described situation from happening:

The main improvements include:

  1. No more lost tokens: ERC223 suggests that involved contracts implement a tokenFallback function that keeps contracts from holding onto tokens that end up there.
  2. Incoming token handlers: Similarly, developers will have more control over incoming tokens by accepting supported tokens and rejecting non-supported ones.
  3. Energy savings: The transfer of ERC223 tokens uses 2x less gas than ERC20, making the process twice as energy efficient.



Updating from ERC20 to ERC223

ERC23 tokens are backwards-compatible with ERC20 tokens. Any transaction made by calling the transfer function on the ERC223 function and ending with a ERC20 wallet or smart contract will succeed, unless the later has not implemented a tokenFallback, in which case it will behave as before.

As for specific differences between the two:

Note that the transfer event has been updated from

event Transfer(address indexed _from, address indexed _to, uint _value);


event Transfer(address indexed _from, address indexed _to, uint _value, bytes data);

meaning that transfer events emit transferred data as well as a value.

Additionally, as mentioned above, smart contracts that operate with ERC223 tokens must implement:

function tokenFallback(address _from, uint _value, bytes _data)

This is a function that will be called from the token contract when the holder sends tokens. An example of a ERC223 compliant token that invokes this tokenFallback function can be found here.

Basically – if you’re building your own token and related contracts, be sure to implement that tokenFallback function so bad things don’t happen!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s