ERC-223

ERC-223: An Enhanced Token Standard

Introduction

ERC-223 is a token standard for Ethereum, proposed as an improvement to the widely used ERC-20 standard. It introduces mechanisms to address critical shortcomings of ERC-20, such as accidental token losses and inefficient gas usage. By defining a new communication model for token transfers, ERC-223 provides a more robust and user-friendly framework for token interactions.


What is ERC-223?

ERC-223 is similar to ERC-20 but extends its functionality by:

  • Handling token transfers on the recipient's side.

  • Preventing the loss of tokens sent to incompatible contracts.

  • Supporting metadata in token transfers for additional transaction context.


Key Features and Differences

Improvements Over ERC-20

  1. Recipient Awareness

    • ERC-223 tokens can only be transferred to contracts that implement the tokenReceived function.

    • Prevents tokens from being permanently lost if sent to non-compatible contracts.

  2. Efficient Transactions

    • Uses a single transfer method instead of separate approve and transferFrom.

    • Reduces gas consumption by eliminating unnecessary calls.

  3. Metadata Support

    • Allows metadata to be included with transfers, enabling context-specific actions.


Workflow Diagram


ERC-223 Implementation

An ERC-223 token must define specific methods and events, as described in EIP-223.

Required Methods

Events

Recipient Contract Requirements

Contracts receiving ERC-223 tokens must implement:

If the recipient contract does not implement this function, the transaction fails, and tokens remain with the sender.


Example Implementation

ERC-223 Token Contract

Recipient Contract


Advantages of ERC-223

  • Safety: Tokens cannot be accidentally lost by sending them to incompatible contracts.

  • Efficiency: Reduces gas costs by requiring fewer transactions.

  • Extensibility: Supports metadata for enhanced functionality.


Limitations

  • Adoption: ERC-223 is not yet widely adopted, limiting compatibility.

  • Backward Compatibility: Existing ERC-20 tools and contracts require modifications to support ERC-223.

  • Gas Costs: The additional recipient checks may increase transaction costs in some scenarios.

Last updated

Was this helpful?