Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article examines EIP6604, which proposes a standard abstract token interface for minting ERC20, ERC721, and ERC1155 tokens off-chain as messages, reifying them on-chain through smart contracts, and dereifying them back into messages.

The following material is translated, summarized, and supplemented with explanations.

I have also covered various other EIPs.

Overview

This proposal introduces the concept of abstract tokens in blockchain technology. Abstract tokens provide a standard interface for off-chain token issuance (minting) in the form of messages, on-chain token materialization through smart contracts (reify), and conversion back into messages (dereify). This process can conform to existing standards such as ERC20, ERC721, and ERC1155, enabling wallets and other applications to handle prospective tokens more effectively before consensus-dependent on-chain events occur.

For more on ERC20, see the following article.

https://chaldene.net/erc20

For more on ERC721, see the following article.

https://chaldene.net/erc721

For more on ERC1155, see the following article.

https://chaldene.net/erc1155

Overview of the Process

Off-chain Token Issuance (Minting)

Tokens are initially issued off-chain as messages. This stage establishes the prospective token and prepares it for use before an actual on-chain transaction occurs.

On-chain Token Materialization (Reification)

The tokens issued off-chain are then reified on-chain through a smart contract. Specifically, a smart contract call formally creates on-chain tokens that previously existed as messages.

Token Dereification

Tokens can be dereified back into messages when necessary. This means converting a concrete on-chain asset back into an abstract message.

Compatibility With Existing Standards

ERC20、ERC721、ERC1155

These standards differ according to the type of token, such as currency, unique assets, or multiple assets. Abstract tokens can conform to these standards, maintaining compatibility with existing wallets and applications.

Abstract tokens are intended to enable more flexible handling of blockchain tokens. Through off-chain issuance, on-chain reification, and dereification, the proposal aims to improve token liquidity and accessibility and expand the applications of blockchain technology. Compatibility with standards such as ERC20, ERC721, and ERC1155 is expected to facilitate integration and adoption within the existing blockchain ecosystem.

Motivation

The concept of abstract tokens aims to reduce the cost and complexity of token issuance and management, particularly in high-volume applications. Deferring on-chain issuance (reification) until token holders need it enables issuance without an initial on-chain fee, benefiting use cases such as airdrops, proof-of-attendance tokens (POAPs), and access credentials. Large-scale token distributions using Merkle trees require participants to supply Merkle proofs when claiming tokens. The new standard aims to improve the claiming process for such distributions.

Main Characteristics

Generic

The standard is compatible with various proof mechanisms, including Merkle trees, digital signatures, and other proofs. This makes token distribution and claiming more flexible.

Legible

Users can query the abstract token contract to obtain information about prospective tokens, such as token IDs, amounts, and URIs. This makes it easier for users to obtain relevant information and understand a token's value and purpose.

Contained

Users do not need to understand the proof mechanism used by a particular token implementation contract. They can participate in the token claiming process without detailed knowledge of its underlying technical mechanisms.

Example Use Cases

  • Airdrops
    • Efficiently distribute new or existing tokens free of charge.
  • Proof-of-attendance tokens (POAPs)
    • Issue tokens proving attendance at an event without imposing an initial issuance cost on participants.
  • Identity and access credentials
    • Securely and efficiently manage tokens representing access rights to particular services or applications.

Relationship to Merkle Trees

Merkle trees are frequently used for large-scale token distributions to spread issuance and claiming costs among participants. However, requiring participants to provide Merkle proofs when claiming tokens can complicate the process. The abstract token standard aims to make claiming more user-friendly, thereby improving the efficiency and accessibility of large-scale distributions.

Specification

Data Types

The following describes the data structures for managing abstract token messages and their states. These are designed as part of a system for handling tokens more flexibly. The concepts described here provide information required to manage off-chain token issuance, on-chain reification, and the reverse process.

Abstract Token Message Structure (AbstractTokenMessage)

ts
struct AbstractTokenMessage {
  uint256 chainId;
  address implementation;
  address owner;
  bytes meta;
  uint256 nonce;
  bytes proof;
}
  • chainId
    • The ID of the blockchain to which the token message applies.
    • This associates the message with a specific chain.
  • implementation
    • The address of the smart contract responsible for reifying the token.
    • The contract issues tokens on-chain according to the message.
  • owner
    • The address of the token owner.
    • This address holds ownership of the token when it is reified.
  • meta
    • Implementation-specific context required to reify the token.
    • It contains token-specific information such as the token ID, amount, and URI.
  • nonce
    • A counter incremented when multiple otherwise identical abstract token messages are required.
    • It distinguishes messages with identical parameters.
  • proof
    • Implementation-specific authorization for reifying the token.
    • It proves that the message sender is authorized to reify the token.

Message Status Enum (AbstractTokenMessageStatus)

ts
enum AbstractTokenMessageStatus {
  invalid,
  valid,
  used
}
  • invalid
    • A state in which the smart contract cannot interact with the message.
  • valid
    • A state in which the smart contract can interact with the message.
  • used
    • A state in which the smart contract has already interacted with the message.

The system tracks token messages from off-chain issuance through on-chain reification and subsequent state changes after use. The key is to balance flexibility and security, providing mechanisms for efficient and secure token issuance and management.

Methods

This section focuses on the main methods for operating abstract tokens. In this context, abstract tokens refer to a system enabling off-chain token issuance, on-chain reification (reify), and dereification (dereify). The following describes each method and its functionality.

reify

  • Purpose
    • Move the tokens represented by a message into the smart contract and reify them on-chain.
  • Behavior
    • Given a valid token message, the token contract must reify tokens according to that message.
  • Idempotency
    • A particular token message can be used to reify tokens at most once.
    • Calling reify with an already consumed message may succeed or revert.

status

  • Purpose
    • Return the status of a particular message.
  • Return value
    • The message status: invalid, valid, or consumed.

dereify

  • Purpose
    • Move tokens from a contract into a message intended for another contract or chain.
  • Optional functionality
    • This allows tokens to move from one context to another.
    • dereify must also be idempotent.
  • Behavior
    • A particular token message can be used to dereify tokens at most once.
    • If the token message has already been consumed, the operation may succeed or revert.

Idempotency

Idempotency is a term frequently used in programming and information technology. An operation is idempotent if repeating it does not introduce further state changes after its first execution. In other words, executing an operation once has the same intended effect on state as executing it multiple times.

This concept is especially important in network communication, database operations, and API design. For example, HTTP GET requests to a web server are considered idempotent. Repeated GET requests for the same resource do not change the resource's state, although the responses can differ if the resource changes independently. HTTP POST requests, by contrast, are generally considered non-idempotent. A POST request can modify server state, for example by adding data. Repeating the same request may add new data each time and produce a different final state.

For abstract tokens, idempotency of reify and dereify means that executing these operations repeatedly with the same token message does not change the token or system state after the first operation. For example, once a token is reified using a particular token message, attempting to reify it again with the same message does not create an additional token. This helps prevent unexpected duplication and errors.

id

  • Purpose
    • Return the token ID defined by a token message.
  • Optional functionality
    • An abstract token contract without a defined token ID, such as ERC20, can omit this method or return 0.

amount

  • Purpose
    • Return the token amount defined by a token message.
  • Optional functionality
    • An abstract token contract without a defined token amount, such as ERC721, can omit this method or return 0.

uri

  • Purpose
    • Return the token URI defined by a token message.
  • Optional functionality
    • An abstract token contract without a defined URI, such as ERC20, can omit this method or return an empty string.

supportsInterface

  • Requirement
    • All abstract token contracts must support ERC165 and include the abstract token interface ID among their supported interfaces.

For more on ERC165, see the following article.

[ERC165] Checking Whether a Contract Supports an Interface

These methods and features are designed to facilitate abstract token management and operations. They support processes ranging from off-chain token issuance and on-chain reification to movement between contracts or chains.

Events

This section describes events used to track token movement within the abstract token system. Emitting events (emit) on a blockchain is a common way to notify external listeners, such as front-end applications and monitoring services, that an action has occurred. The Reify and Dereify events occur when tokens are reified on-chain and dereified back into messages, respectively.

Reify Event

  • Purpose
    • Emitted when a token message is reified into actual on-chain tokens.
  • Importance
    • The event records when an abstract token message is converted into on-chain tokens, allowing external monitoring systems and user interfaces to detect the action and respond appropriately.

Dereify Event

  • Purpose
    • Emitted when tokens are dereified back into a message intended for a specific contract or chain.
  • Importance
    • Tracking dereification enables external listeners to identify token movements, including movements across chains.
    • This is particularly useful for applications supporting asset transfers between different blockchains.

Implementation Considerations

  • Idempotency
    • Reify and Dereify operations must be idempotent, so repeated operations based on the same token message do not introduce additional state changes.
    • In particular, attempts to reify tokens using an already consumed message may be rejected or fail.
  • Transparency
    • These events make the corresponding token movements visible on-chain, facilitating transaction audits and token flow tracking.

The Reify and Dereify events are important sources of information for developers and users because they identify key actions within the abstract token framework. By using these events appropriately, applications can detect important changes in the token lifecycle and respond to them in real time.

Applying Abstract Tokens to Existing Token Standards

For compatibility with existing token standards, token transfer functions must be overloaded to support transfers based on abstract token messages. This allows the abstract token system to integrate with existing standards such as ERC20, ERC721, and ERC1155 and enables token transfers through off-chain messages.

Background

Blockchain token standards such as ERC20, ERC721, and ERC1155 define rules and functions for token transfers and management. Smart contracts conforming to these standards implement token issuance, transfers, and other operations in the prescribed manner.

Integrating Abstract Tokens

The abstract token system introduces off-chain token issuance, on-chain reification (reify), and the reverse process (dereify). Integrating the system with existing token standards requires extending these basic operations.

Implementation Approach

  1. Function overloading

    • For example, the transfer function in ERC20 handles token transfers.
    • An abstract token system must overload transfer to accept an abstract token message as an argument and add logic for transferring tokens based on it.
  2. Processing abstract token messages

    • Overloaded functions must interpret abstract token messages and execute the appropriate token operation, such as a transfer.
    • This includes verifying the message, identifying the token owner, and checking the token amount.
  3. Maintaining compatibility

    • Care must be taken to preserve compatibility so that applications and wallets conforming to existing standards can also support abstract tokens.
    • Operations based on existing standards should continue to work while new operations involving abstract token messages are supported.

For abstract tokens to remain compatible with existing standards, existing transfer functions must be extended to support transfers using abstract token messages. This enables flexible token management and transfers and supports new blockchain application use cases.

Abstract ERC-20

ts
interface IAbstractERC20 is IAbstractToken, IERC20, IERC165 {
  // reify the message and then transfer tokens
  function transfer(
    address to,
    uint256 amount,
    AbstractTokenMessage calldata message
  ) external returns (bool);

  // reify the message and then transferFrom tokens
  function transferFrom(
    address from,
    address to,
    uint256 amount,
    AbstractTokenMessage calldata message
  ) external returns (bool);
}

transfer

javascript
function transfer(
  address to,
  uint256 amount,
  AbstractTokenMessage calldata message
) external returns (bool);

Overview

Reifies a message and then transfers tokens.

Details

This function accepts an abstract token message, reifies it on-chain, and transfers the tokens to the specified address. It extends the ERC20 transfer function to support transfers through abstract token messages.

Arguments

  • to
    • The token recipient's address.
  • amount
    • The amount of tokens to transfer.
  • message
    • The abstract token message.
    • The message is reified before the token transfer.

Return value

  • bool
    • Indicates whether the operation succeeded.

transferFrom

javascript
function transferFrom(
  address from,
  address to,
  uint256 amount,
  AbstractTokenMessage calldata message
) external returns (bool);

Overview

Reifies a message and transfers tokens from one address to another.

Details

This function accepts an abstract token message, reifies it on-chain, and transfers tokens from one address to another. It extends the ERC20 transferFrom function to support transfers through abstract token messages. This operation is typically used when a token owner has authorized another party to transfer tokens on their behalf.

Arguments

  • from
    • The token sender's address.
  • to
    • The token recipient's address.
  • amount
    • The amount of tokens to transfer.
  • message
    • The abstract token message, which is reified before the transfer.

Return value

  • bool
    • Indicates whether the operation succeeded.

Abstract ERC-721

ts
interface IAbstractERC721 is IAbstractToken, IERC721 {
  function safeTransferFrom(
    address from,
    address to,
    uint256 tokenId,
    bytes calldata _data,
    AbstractTokenMessage calldata message
  ) external;

  function transferFrom(
    address from,
    address to,
    uint256 tokenId,
    AbstractTokenMessage calldata message
  ) external;
}

safeTransferFrom

javascript
function safeTransferFrom(
  address from,
  address to,
  uint256 tokenId,
  bytes calldata _data,
  AbstractTokenMessage calldata message
) external;

Overview

Reifies a message and then safely transfers a token.

Details

This function uses an abstract token message to safely transfer an ERC721 token with a specific token ID from one address to another. safeTransferFrom performs an additional check to determine whether the recipient can accept the token. When transferring to a contract, this helps ensure that the contract supports receiving the token.

Arguments

  • from
    • The token sender's address.
  • to
    • The token recipient's address.
  • tokenId
    • The ID of the token being transferred.
  • _data
    • Additional data sent with the token transfer.
    • This data may be used by the receiving contract's token acceptance logic.
  • message
    • The abstract token message.
    • The message is reified before the transfer.

transferFrom

javascript
function transferFrom(
  address from,
  address to,
  uint256 tokenId,
  AbstractTokenMessage calldata message
) external;

Overview

Reifies a message and then transfers a token.

Details

This function uses an abstract token message to transfer an ERC721 token with a specific token ID from one address to another. transferFrom is used by the owner or an approved party to transfer the token. Unlike safeTransferFrom, this function does not check whether the recipient can accept the token.

Arguments

  • from
    • The token sender's address.
  • to
    • The token recipient's address.
  • tokenId
    • The ID of the token being transferred.
  • message
    • The abstract token message.
    • The message is reified before the transfer.

Abstract ERC-1155

ts
interface IAbstractERC1155 is IAbstractToken, IERC1155 {
  function safeTransferFrom(
    address from,
    address to,
    uint256 id,
    uint256 amount,
    bytes calldata data,
    AbstractTokenMessage calldata message
  ) external;

  function safeBatchTransferFrom(
    address from,
    address to,
    uint256[] calldata ids,
    uint256[] calldata amounts,
    bytes calldata data,
    AbstractTokenMessage[] calldata messages
  ) external;
}

safeTransferFrom

javascript
function safeTransferFrom(
  address from,
  address to,
  uint256 id,
  uint256 amount,
  bytes calldata data,
  AbstractTokenMessage calldata message
) external;

Overview

Reifies a message and then safely transfers a single token type.

Details

This function uses an abstract token message to enable a safe transfer of tokens conforming to ERC1155. The transfer uses the specified token ID and amount and can include transfer data and the message. If the recipient is a contract, the function verifies that it supports receiving the tokens.

Arguments

  • from
    • The token sender's address.
  • to
    • The token recipient's address.
  • id
    • The ID of the tokens being transferred.
  • amount
    • The amount of tokens being transferred.
  • data
    • Additional data sent with the token transfer.
  • message
    • The abstract token message.
    • The message is reified before the transfer.

safeBatchTransferFrom

javascript
function safeBatchTransferFrom(
  address from,
  address to,
  uint256[] calldata ids,
  uint256[] calldata amounts,
  bytes calldata data,
  AbstractTokenMessage[] calldata messages
) external;

Overview

Reifies messages and then safely transfers multiple token types in a batch.

Details

This function uses multiple abstract token messages to safely transfer multiple token types conforming to ERC1155 in a batch. The transfer uses arrays of token IDs and amounts and can include additional transfer data and an array of messages. Batching allows multiple token transfers to be executed efficiently in one transaction.

Arguments

  • from
    • The token sender's address.
  • to
    • The token recipient's address.
  • ids
    • An array of token IDs to transfer.
  • amounts
    • An array of token amounts corresponding to each token ID.
  • data
    • Additional data sent with the token transfers.
  • messages
    • An array of abstract token messages.
    • These messages are reified before the transfers.

Additional Details

This section explains the design rationale for the metadata (meta) and proof fields of an abstract token message. These fields are designed to preserve flexibility and future extensibility in the abstract token system.

Metadata Format

Overview

The meta field is defined as a plain byte array to support the broadest possible range of formats.

Details
  • Accessibility
    • A byte array allows different kinds of metadata to be handled flexibly.
    • This accommodates future token standards and unforeseen metadata formats.
  • Interaction With the Implementation Contract
    • Applications handling abstract tokens can interact with the implementation contract to retrieve token metadata rather than parsing this field directly.
    • This makes direct readability of the meta field a secondary concern.
  • Error Checking and Decoding
    • The implementation contract can decode the byte array into a struct and perform error checks.
    • This supports different metadata formats while allowing appropriate error handling.

Proof Format

Overview

The proof field is also defined as a plain byte array. This design accommodates varying contents.

Details
  • Varied Content
    • The proof field may contain an array of Merkle tree nodes, a 65-byte signature, or other data, depending on the use case.
  • Broad Use-case Coverage
    • Using a byte array accommodates possible future use cases, at the cost of increased message size.

The meta and proof fields use byte arrays to preserve the generality and extensibility of the abstract token system. This supports various metadata formats and proof mechanisms while preparing for future token standards and new use cases.

Compatibility

No particular compatibility issues have been identified.

Implementation

The implementation code is available below.

Security

This section describes security concerns involving abstract tokens.

Message Loss

  • Issue
    • Abstract token messages are not stored on-chain, so losing a message may result in losing the corresponding tokens.
  • Mitigation
    • Applications issuing abstract tokens can store messages themselves, but ideally users should be able to store and interact with abstract token messages in their own cryptocurrency wallets.

Reification Authorization

  • Issue
    • Token messages can be reified on-chain only when they contain valid proof.
    • The proof mechanism is outside the scope of this standard, but its design requires consideration of several factors.
  • Considerations
    • Does total supply need to be audited on-chain, off-chain, or both?
    • Does the mechanism require continuous access to a secret, as with digital signatures, or is it immutable, as with Merkle proofs?
    • Can an attacker prevent a valid token message from being reified?

Reification or Dereification by Non-owners

  • Issue
    • Whether non-owners can reify or dereify token messages on behalf of owners.
  • Benefit
    • When a valid message exists, an owner can reify or dereify tokens at any time, and supporting applications should be able to handle this behavior.
  • Drawback
    • If the token contract reverts when reifying or dereifying an already consumed message, an attacker may disrupt the owner by front-running a transaction.

Double Spending in Abstract Token Bridges

  • Issue
    • Abstract tokens may be used for token-specific bridges, but the standard does not specify cross-chain message passing.
    • Abstract token contracts on chains A and B therefore cannot independently determine whether message M has been reified or dereified on the other chain.
  • Double-spending Risk
    • When a transfer from chain A to chain B is requested, the bridge mechanism creates abstract token message M.
    • If M is reified on chain B while the corresponding tokens remain available on chain A, the same assets may remain spendable on both chains.
  • Mitigation
    • An oracle or equivalent cross-chain verification mechanism is needed to prevent reification on chain B until the corresponding tokens on chain A have been dereified.

These security considerations are important when designing and implementing abstract token systems. Addressing these issues appropriately helps ensure their security and efficiency.

Citation

Chris Walker (@cr-walker) chris@ckwalker.com, "ERC-6604: Abstract Token [DRAFT]," Ethereum Improvement Proposals, no. 6604, March 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-6604.

Conclusion

This article covered EIP6604, which proposes a standard abstract token interface for minting ERC20, ERC721, and ERC1155 tokens off-chain as messages, reifying them on-chain through smart contracts, and dereifying them back into messages. I hope you found it useful.

If you have questions, feel free to contact me by direct message on Twitter.

Twitter @cardene777

I also share information on other platforms, so feel free to explore them.

https://chaldene.net/