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 ERC-4341, which proposes preserving the order of multiple NFT transfers.

This article translates, summarizes, and supplements the material linked below.

I have also covered other EIPs.

Overview

ERC-4341 proposes a contract interface for handling multiple tokens in an ordered sequence.

Encoding Unicode code points directly into token IDs allows tokens to represent meaningful symbols, including Chinese characters and emoji.

This enables strings to be transmitted and retained as collections of tokens without losing their intended sequence or meaning.

Motivation

Conventional ERC-721 and ERC-1155 ownership records do not inherently preserve the semantic ordering of a group of tokens.

When token IDs represent Unicode characters, their order determines the meaning of words and phrases.

For example, sending Unicode code points 38271 and 22478 in that order represents the Chinese characters 長城 (Great Wall). Reversing them produces 城長, which has a different meaning.

Ordered Unicode tokens have potential cultural and practical uses.

  • Characters and phrases can be given as gifts, drawing on traditions in East Asia.
  • Poetry, proverbs, and sayings can be preserved through meaningful sequences of characters.
  • Emoji can be transmitted in an ordered sequence to express emotions or symbols.

Other potential applications include Chinese chess (xiangqi), wedding vows, family mottos, and prayers.

Specification

Interface

ERC4341.sol
pragma solidity ^0.8.0;

/**
    @title EIP-4341 Multi Ordered NFT Standard
    @dev See https://eips.ethereum.org/EIPS/eip-4341
 */
interface ERC4341 /* is ERC165 */ {
    event Transfer(address indexed from, address indexed to, uint256 id, uint256 amount);

    event TransferBatch(address indexed from, address indexed to, uint256[] ids, uint256[] amounts);

    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

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

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

    function safePhraseTransferFrom(address from, address to, uint256[] calldata phrase, bytes calldata data) external;

    function balanceOf(address owner, uint256 id) external view returns (uint256);

    function balanceOfPhrase(address owner) external view returns (uint256);

    function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external view returns (uint256[] memory);

    function retrievePhrase(address owner, uint256 phraseId) external view returns (uint256[] memory);

    function setApprovalForAll(address operator, bool approved) external;

    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

Events

Transfer

js
event Transfer(address indexed from, address indexed to, uint256 id, uint256 amount);

Emitted when a single token ID is transferred. The log records the sender, recipient, token ID, and quantity.

Parameters

  • from
    • Sender's wallet address.
  • to
    • Recipient's wallet address.
  • id
    • ID of the token being transferred.
  • amount
    • Quantity being transferred.

TransferBatch

js
event TransferBatch(address indexed from, address indexed to, uint256[] ids, uint256[] amounts);

Emitted when multiple token IDs and quantities are transferred as an ordered batch.

The indices of ids and amounts correspond to each other and must preserve the applicable order.

Parameters

  • from
    • Sender address.
  • to
    • Recipient address.
  • ids
    • Array of transferred token IDs.
  • amounts
    • Array of quantities corresponding to those token IDs.

ApprovalForAll

js
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

Emitted when an owner grants or revokes permission for an operator to manage all of their tokens.

Applications can use the event to track authorization granted to external contracts such as marketplaces or game logic.

Parameters

  • owner
    • Token owner's address.
  • operator
    • Address receiving authorization.
  • approved
    • true grants approval; false revokes it.

Functions

safeTransferFrom

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

Safely transfers amount units of token ID id from from to to.

The operation reverts if the recipient contract does not satisfy the applicable receiver requirements.

Arguments

  • from
    • Sender address.
  • to
    • Recipient address.
  • id
    • Token ID.
  • amount
    • Quantity to transfer.
  • data
    • Arbitrary additional bytes.

safeBatchTransferFrom

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

Safely transfers multiple token IDs and quantities while retaining the order of the ids and amounts arrays.

The operation reverts if a contract recipient does not satisfy the applicable receiver requirements. Consult the specification for the required callback interface rather than assuming it is the ERC-721 receiver interface.

Arguments

  • from
    • Sender address.
  • to
    • Recipient address.
  • ids
    • Array of token IDs.
  • amounts
    • Quantities corresponding to the token IDs.
  • data
    • Additional bytes.

safePhraseTransferFrom

js
function safePhraseTransferFrom(address from, address to, uint256[] calldata phrase, bytes calldata data) external;

Safely transfers a sequence of tokens representing a Unicode phrase.

The order of the phrase array determines its meaning and must be preserved when transferring it from from to to.

Arguments

  • from
    • Sender address.
  • to
    • Recipient address.
  • phrase
    • Ordered array of token IDs forming the phrase.
  • data
    • Additional bytes.

balanceOf

js
function balanceOf(address owner, uint256 id) external view returns (uint256);

Returns the quantity of a particular token ID held by an address. This can represent the balance of tokens corresponding to a Unicode character.

Arguments

  • owner
    • Address whose balance is queried.
  • id
    • Token ID.

Return value

  • uint256
    • Token balance.

balanceOfPhrase

js
function balanceOfPhrase(address owner) external view returns (uint256);

Returns the phrase-related balance for the specified address. The exact interpretation must follow the phrase accounting defined by the implementation and specification.

Arguments

  • owner
    • Address being queried.

Return value

  • uint256
    • Phrase-related balance.

balanceOfBatch

js
function balanceOfBatch(address[] calldata owners, uint256[] calldata ids) external view returns (uint256[] memory);

Retrieves balances for multiple address and token ID pairs.

The result corresponds to the pairs owners[i] and ids[i], so the arrays must have matching lengths.

Arguments

  • owners
    • Array of addresses to query.
  • ids
    • Array of token IDs.

Return value

  • uint256[]
    • Balances corresponding to the requested pairs.

retrievePhrase

js
function retrievePhrase(address owner, uint256 phraseId) external view returns (uint256[] memory);

Retrieves the ordered sequence of token IDs associated with a phrase ID held by the specified address.

The phraseId identifies a phrase managed by the implementation.

Arguments

  • owner
    • Address being queried.
  • phraseId
    • Identifier of the phrase to retrieve.

Return value

  • uint256[]
    • Ordered token IDs forming the phrase.

setApprovalForAll

js
function setApprovalForAll(address operator, bool approved) external;

Grants or revokes permission for an operator to manage all tokens belonging to the caller.

This can authorize marketplaces to perform transfers on behalf of an owner. The operation emits ApprovalForAll.

Arguments

  • operator
    • Address whose authorization is configured.
  • approved
    • true grants approval; false revokes it.

isApprovedForAll

js
function isApprovedForAll(address owner, address operator) external view returns (bool);

Checks whether an operator is authorized to manage the owner's tokens, according to the approval state configured through setApprovalForAll.

Arguments

  • owner
    • Token owner's address.
  • operator
    • Address whose authorization is queried.

Return value

  • bool
    • Whether approval has been granted.

Additional Notes

Why Preserve Ordering?

When Unicode values are used as token IDs, their sequence determines the meaning of a string.

Although ERC-1155 batch calls and events preserve the supplied array order, ordinary token balances do not retain a persistent phrase structure. ERC-4341 introduces a phrase representation to address that limitation.

Definition of a Phrase

A phrase groups characters or Unicode values into an ordered sequence.

It can be represented as a uint256[] array without changing the total token supply.

The phrase record itself is not independently transferable as a separate token; it can be retrieved and decoded to reconstruct the original Unicode sequence.

Technical Properties of Phrases

  • Storage format
    • Store token IDs in order in a uint256[].
  • Operation restrictions
    • Phrase records can be created or removed rather than transferred directly as separate assets.
  • Retrieval
    • Call retrievePhrase and decode the returned sequence to display the string.
  • Accounting
    • Creating phrase records does not itself increase or decrease the underlying token supply.

Storage Impact

Retaining phrase arrays requires additional storage compared with an implementation using only conventional ERC-1155 balances.

This is a trade-off associated with preserving ordered data for applications that represent strings and phrases.

Citation

Simon Tian (@simontianx), "ERC-4341: Ordered NFT Batch Standard [DRAFT]," Ethereum Improvement Proposals, no. 4341, October 2021. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-4341.

Conclusion

ERC-4341 proposes an ordered NFT batch interface for preserving the meaning of token sequences.

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

Twitter @cardene777

I also publish articles on the following platforms.

https://chaldene.net/