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 covers ERC-5773, a proposal that lets NFTs provide different assets and output formats depending on the medium through which they are accessed.
The following explanation translates, summarizes, and expands on the original proposal.
Overview
The multi-asset NFT standard provides a more flexible way to represent digital assets in a variety of formats, allowing different information to be displayed for individual NFTs.
Context-dependent output means displaying an asset in the most suitable format depending on how the NFT is accessed. For example, opening an NFT in an e-book reader could display a PDF asset, while viewing it in a marketplace could display a PNG or SVG asset. Accessing it from a game could display a 3D model, while accessing it from an IoT hub could retrieve an asset providing the necessary addressing and specification information.
Addressing is a method used in computer systems and networks to identify the location or identifier of a particular resource or piece of data. It generally refers to a unique identifier or a way of specifying a location that contains information for identifying data or resources.
In the context of the Internet of Things (IoT), addressing concerns information associated with physical devices, sensors, actuators, and similar components. When an NFT is accessed from an IoT hub, the retrieved asset may provide addressing information such as the location of its associated IoT device, connection details, communication protocols, and how to interpret sensor data.
This addressing information allows an IoT device to retrieve and process information or instructions associated with the NFT appropriately. Addressing is important in IoT for effective communication between devices, data retrieval, and device control.
An NFT can contain multiple assets (information outputs).
These assets are files provided to consumers and arranged in order of priority.
Their mimetype (file type) and tokenURI (address of token information) need not match, nor do they need to affect one another.
Think of these assets as namespaced tokenURIs that the token owner can arrange in any order.
Note, however, that modifying, updating, adding, or removing assets requires agreement between the NFT owner and issuer.
Motivation
NFTs (non-fungible tokens) are digital tokens widely used throughout the Ethereum ecosystem for many purposes. This proposal aims to standardize a way to introduce new uses and value to NFTs. Associating several different assets with a single NFT can provide greater utility, usability, and future compatibility.
In the four years since the publication of ERC-721, demand for additional NFT functionality has led to numerous extensions. This EIP (Ethereum Improvement Proposal) proposes extending ERC-721 in the following ways.
-
Cross-metaverse compatibility Because the concept of the metaverse is still immature, it is important to remain flexible enough to accommodate its future evolution. This makes it possible to support a variety of implementations.
-
Multimedia output By holding media in different formats, an NFT can be used across a wider range of platforms and applications. Examples include an asset representing an in-game cosmetic item and a stylized thumbnail for a marketplace.
-
Media redundancy Providing the same information or asset through multiple methods introduces redundancy. This reduces the risk of information loss and makes displaying and using the assets more reliable.
-
NFT evolution An NFT itself may evolve, and the proposal provides a flexible mechanism for adding new information and functionality.
Two particularly important aspects of the proposal are cross-metaverse compatibility and multimedia output. Cross-metaverse compatibility allows assets to be used in different environments across games and platforms. Multimedia output lets NFTs contain media such as images, videos, and audio, making them applicable to a wide range of content.
The proposal is an effort to expand the future possibilities of NFTs and make them more flexible and easier to use.
Cross-metaverse compatibility
The proposal introduces a way to give NFTs greater utility and flexibility. First, cross-metaverse compatibility relates to the term metaverse, whose definition may change as the technology evolves. The metaverse is not yet clearly defined, but the proposal is designed to support different implementations regardless of how it evolves.
Cross-metaverse compatibility refers to interoperability between different metaverses and game engines. For example, an item from Game A may not work in Game B. This is a compatibility problem arising from differences between game engines.
Such NFTs can gain additional utility by incorporating new assets. For example, associating different games or items with the same NFT turns an item from one game into an evolving NFT that can be used in different contexts and on different platforms.
Imagine that you play two different games, Game A and Game B. Each game has different characters and items. Suppose you want to use an impressive sword or shield obtained in Game A in Game B as well.
This is where cross-metaverse compatibility comes in. It provides a mechanism for using the sword or shield from Game A in Game B. This makes it possible to share items across different games.
Consider a concrete example of the assets involved. The impressive sword you obtained in Game A is one asset. That asset contains information about the sword's appearance and characteristics. A second asset is prepared so that the sword can also be used in Game B. This asset contains the sword's information as represented in Game B. A third asset contains general-purpose information that can be displayed in any game, as well as in catalogs, marketplaces, and NFT viewers. This could include a stylized thumbnail of the sword or an animated demo or trailer. Other people can use this asset to see what makes the sword appealing.
The proposal adds an abstraction layer that lets game developers retrieve asset data from users' NFTs easily. This enables more flexible and varied applications and experiences without hardcoding asset handling.
Multimedia output
Consider an NFT representing an e-book. This NFT can be displayed using different file formats depending on the form of the book. When loaded in an e-book reader, it is displayed as a PDF file. When the same NFT is loaded in an audiobook app, an MP3 file is used instead and played as audio. The NFT may also contain metadata such as the book's title, author, and cover image. This allows the NFT to be identified and displayed appropriately in different contexts and locations. For example, marketplaces, search result pages, and portfolio trackers can display suitable information about the NFT.
Media redundancy
When NFTs are created in a hurry, security and data management practices may not receive sufficient consideration. As a result, NFT metadata (information about the assets and their characteristics) may be hosted on a single server. If that server fails, all information about the associated NFTs risks being lost.
In some cases, a particular IPFS (InterPlanetary File System) gateway is also hardcoded to provide access to NFT metadata. IPFS is a distributed file-sharing protocol that provides a mechanism for storing files across users' computers. However, if a particular IPFS gateway becomes unavailable, access to NFT metadata may be disrupted.
These approaches have a single point of failure and low fault tolerance. If a server or a particular IPFS gateway goes down, users and owners may be inconvenienced by losing access to the associated NFT information. Data security is also a concern.
To address this problem, add the same metadata file in multiple locations as separate assets. For example, adding the same metadata and associated images to different protocols such as Arweave, Sia, and IPFS creates redundancy and improves fault tolerance. Because all of the protocols are unlikely to fail simultaneously, the risk of data loss is reduced. This approach better protects NFT metadata and its references, enabling more reliable operation.
NFT evolution
Many NFTs, especially those used in games, need to evolve. In particular, many contemporary metaverses are essentially multiplayer games in which username-and-password login has been replaced with a check for NFT ownership.
For example, if a game's servers go down or the game shuts down, players may be left with nothing (losing their experience points) or with assets and accessories that no longer serve a purpose in the game. In such cases, incompatibility with other metaverses can result in unrelated assets appearing in wallets or items that cannot be used in other verses (see the earlier discussion of cross-metaverse compatibility).
With multi-asset NFTs, an issuer or preapproved entity can propose a new asset to an NFT owner. The owner can accept or reject the proposal. A proposed asset can also replace an existing asset.
Asset replacement is somewhat similar to replacing the URI of an ERC-721 token. After an asset is replaced, the old asset remains accessible and verifiable. Replacing an asset's metadata URI can obscure the asset's change history. Preventing issuers from freely replacing NFT assets also increases the assurances available to token owners. The replacement mechanism in this proposal provides those assurances.
This feature allows a user to accept a level-up after accumulating experience points. A level-up adds a new asset to the NFT; accepting it replaces the old asset with the new one.
Consider Pokémon evolution as a concrete example. After gaining enough experience points, a trainer can evolve a monster. Using a multi-asset NFT, replacing an asset requires neither centralized management nor sending a separate NFT to the user's wallet. Instead, a new asset (such as Raichu) is proposed as a replacement for the existing asset (such as Pikachu). Upon acceptance, the Pikachu asset is removed from the active assets and replaced with Raichu. Raichu then has its own attributes and value.
Another example is version management for IoT device firmware. An asset represents the current firmware. When an update becomes available, replacing the current asset with a new one represents the firmware update.
Firmware
Firmware is a type of software embedded in hardware such as computers and electronic devices. It usually consists of programs or instructions for controlling and managing hardware operations. Firmware controls a device's behavior and functionality and provides an interface between hardware and software.
Examples of devices containing firmware include computer motherboards, graphics cards, network devices, routers, smartphones, digital cameras, and household appliances. Firmware handles functions such as device initialization, configuration, control, and upgrades, helping ensure the device operates correctly.
For IoT devices, firmware controls device behavior, communication protocols, and security features. Updates and upgrades can improve functionality and security as needed.
Specification
/// @title ERC-5773 Context-Dependent Multi-Asset Tokens
/// @dev See https://eips.ethereum.org/EIPS/eip-5773
/// @dev Note: the ERC-165 identifier for this interface is 0x06b4329a.
pragma solidity ^0.8.16;
interface IERC5773 /* is ERC165 */ {
/**
* @notice Used to notify listeners that an asset object is initialised at `assetId`.
* @param assetId ID of the asset that was initialised
*/
event AssetSet(uint64 assetId);
/**
* @notice Used to notify listeners that an asset object at `assetId` is added to token's pending asset
* array.
* @param tokenIds An array of IDs of the tokens that received a new pending asset
* @param assetId ID of the asset that has been added to the token's pending assets array
* @param replacesId ID of the asset that would be replaced
*/
event AssetAddedToTokens(
uint256[] tokenIds,
uint64 indexed assetId,
uint64 indexed replacesId
);
/**
* @notice Used to notify listeners that an asset object at `assetId` is accepted by the token and migrated
* from token's pending assets array to active assets array of the token.
* @param tokenId ID of the token that had a new asset accepted
* @param assetId ID of the asset that was accepted
* @param replacesId ID of the asset that was replaced
*/
event AssetAccepted(
uint256 indexed tokenId,
uint64 indexed assetId,
uint64 indexed replacesId
);
/**
* @notice Used to notify listeners that an asset object at `assetId` is rejected from token and is dropped
* from the pending assets array of the token.
* @param tokenId ID of the token that had an asset rejected
* @param assetId ID of the asset that was rejected
*/
event AssetRejected(uint256 indexed tokenId, uint64 indexed assetId);
/**
* @notice Used to notify listeners that token's priority array is reordered.
* @param tokenId ID of the token that had the asset priority array updated
*/
event AssetPrioritySet(uint256 indexed tokenId);
/**
* @notice Used to notify listeners that owner has granted an approval to the user to manage the assets of a
* given token.
* @dev Approvals must be cleared on transfer
* @param owner Address of the account that has granted the approval for all token's assets
* @param approved Address of the account that has been granted approval to manage the token's assets
* @param tokenId ID of the token on which the approval was granted
*/
event ApprovalForAssets(
address indexed owner,
address indexed approved,
uint256 indexed tokenId
);
/**
* @notice Used to notify listeners that owner has granted approval to the user to manage assets of all of their
* tokens.
* @param owner Address of the account that has granted the approval for all assets on all of their tokens
* @param operator Address of the account that has been granted the approval to manage the token's assets on all of the
* tokens
* @param approved Boolean value signifying whether the permission has been granted (`true`) or revoked (`false`)
*/
event ApprovalForAllForAssets(
address indexed owner,
address indexed operator,
bool approved
);
/**
* @notice Accepts an asset at from the pending array of given token.
* @dev Migrates the asset from the token's pending asset array to the token's active asset array.
* @dev Active assets cannot be removed by anyone, but can be replaced by a new asset.
* @dev Requirements:
*
* - The caller must own the token or be approved to manage the token's assets
* - `tokenId` must exist.
* - `index` must be in range of the length of the pending asset array.
* @dev Emits an {AssetAccepted} event.
* @param tokenId ID of the token for which to accept the pending asset
* @param index Index of the asset in the pending array to accept
* @param assetId Id of the asset expected to be in the index
*/
function acceptAsset(
uint256 tokenId,
uint256 index,
uint64 assetId
) external;
/**
* @notice Rejects an asset from the pending array of given token.
* @dev Removes the asset from the token's pending asset array.
* @dev Requirements:
*
* - The caller must own the token or be approved to manage the token's assets
* - `tokenId` must exist.
* - `index` must be in range of the length of the pending asset array.
* @dev Emits a {AssetRejected} event.
* @param tokenId ID of the token that the asset is being rejected from
* @param index Index of the asset in the pending array to be rejected
* @param assetId Id of the asset expected to be in the index
*/
function rejectAsset(
uint256 tokenId,
uint256 index,
uint64 assetId
) external;
/**
* @notice Rejects all assets from the pending array of a given token.
* @dev Effectively deletes the pending array.
* @dev Requirements:
*
* - The caller must own the token or be approved to manage the token's assets
* - `tokenId` must exist.
* @dev Emits a {AssetRejected} event with assetId = 0.
* @param tokenId ID of the token of which to clear the pending array
* @param maxRejections to prevent from rejecting assets which arrive just before this operation.
*/
function rejectAllAssets(uint256 tokenId, uint256 maxRejections) external;
/**
* @notice Sets a new priority array for a given token.
* @dev The priority array is a non-sequential list of `uint16`s, where the lowest value is considered highest
* priority.
* @dev Value `0` of a priority is a special case equivalent to uninitialised.
* @dev Requirements:
*
* - The caller must own the token or be approved to manage the token's assets
* - `tokenId` must exist.
* - The length of `priorities` must be equal the length of the active assets array.
* @dev Emits a {AssetPrioritySet} event.
* @param tokenId ID of the token to set the priorities for
* @param priorities An array of priorities of active assets. The succession of items in the priorities array
* matches that of the succession of items in the active array
*/
function setPriority(uint256 tokenId, uint64[] calldata priorities)
external;
/**
* @notice Used to retrieve IDs of the active assets of given token.
* @dev Asset data is stored by reference, in order to access the data corresponding to the ID, call
* `getAssetMetadata(tokenId, assetId)`.
* @dev You can safely get 10k
* @param tokenId ID of the token to retrieve the IDs of the active assets
* @return uint64[] An array of active asset IDs of the given token
*/
function getActiveAssets(uint256 tokenId)
external
view
returns (uint64[] memory);
/**
* @notice Used to retrieve IDs of the pending assets of given token.
* @dev Asset data is stored by reference, in order to access the data corresponding to the ID, call
* `getAssetMetadata(tokenId, assetId)`.
* @param tokenId ID of the token to retrieve the IDs of the pending assets
* @return uint64[] An array of pending asset IDs of the given token
*/
function getPendingAssets(uint256 tokenId)
external
view
returns (uint64[] memory);
/**
* @notice Used to retrieve the priorities of the active assets of a given token.
* @dev Asset priorities are a non-sequential array of uint16 values with an array size equal to active asset
* priorites.
* @param tokenId ID of the token for which to retrieve the priorities of the active assets
* @return uint16[] An array of priorities of the active assets of the given token
*/
function getActiveAssetPriorities(uint256 tokenId)
external
view
returns (uint64[] memory);
/**
* @notice Used to retrieve the asset that will be replaced if a given asset from the token's pending array
* is accepted.
* @dev Asset data is stored by reference, in order to access the data corresponding to the ID, call
* `getAssetMetadata(tokenId, assetId)`.
* @param tokenId ID of the token to check
* @param newAssetId ID of the pending asset which will be accepted
* @return uint64 ID of the asset which will be replaced
*/
function getAssetReplacements(uint256 tokenId, uint64 newAssetId)
external
view
returns (uint64);
/**
* @notice Used to fetch the asset metadata of the specified token's active asset with the given index.
* @dev Can be overriden to implement enumerate, fallback or other custom logic.
* @param tokenId ID of the token from which to retrieve the asset metadata
* @param assetId Asset Id, must be in the active assets array
* @return string The metadata of the asset belonging to the specified index in the token's active assets
* array
*/
function getAssetMetadata(uint256 tokenId, uint64 assetId)
external
view
returns (string memory);
/**
* @notice Used to grant permission to the user to manage token's assets.
* @dev This differs from transfer approvals, as approvals are not cleared when the approved party accepts or
* rejects an asset, or sets asset priorities. This approval is cleared on token transfer.
* @dev Only a single account can be approved at a time, so approving the `0x0` address clears previous approvals.
* @dev Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
* @dev Emits an {ApprovalForAssets} event.
* @param to Address of the account to grant the approval to
* @param tokenId ID of the token for which the approval to manage the assets is granted
*/
function approveForAssets(address to, uint256 tokenId) external;
/**
* @notice Used to retrieve the address of the account approved to manage assets of a given token.
* @dev Requirements:
*
* - `tokenId` must exist.
* @param tokenId ID of the token for which to retrieve the approved address
* @return address Address of the account that is approved to manage the specified token's assets
*/
function getApprovedForAssets(uint256 tokenId)
external
view
returns (address);
/**
* @notice Used to add or remove an operator of assets for the caller.
* @dev Operators can call {acceptAsset}, {rejectAsset}, {rejectAllAssets} or {setPriority} for any token
* owned by the caller.
* @dev Requirements:
*
* - The `operator` cannot be the caller.
* @dev Emits an {ApprovalForAllForAssets} event.
* @param operator Address of the account to which the operator role is granted or revoked from
* @param approved The boolean value indicating whether the operator role is being granted (`true`) or revoked
* (`false`)
*/
function setApprovalForAllForAssets(address operator, bool approved)
external;
/**
* @notice Used to check whether the address has been granted the operator role by a given address or not.
* @dev See {setApprovalForAllForAssets}.
* @param owner Address of the account that we are checking for whether it has granted the operator role
* @param operator Address of the account that we are checking whether it has the operator role or not
* @return bool The boolean value indicating whether the account we are checking has been granted the operator role
*/
function isApprovedForAllForAssets(address owner, address operator)
external
view
returns (bool);
}AssetSet
Overview An event indicating that an asset has been initialized.
Parameters
assetId- ID of the initialized asset.
AssetAddedToTokens
Overview An event indicating that an asset has been added to a token's pending assets array.
The pending assets array is one of the concepts used in ERC-5773 context-dependent multi-asset tokens. It is a list that temporarily holds assets being added to a token by its owner or an approved entity.
Specifically, the pending assets array contains assets that have not yet been accepted as active assets of the token. When a token owner or approved entity adds a new asset to a token, it is first added to the pending assets array. The token owner or approved entity then reviews and approves or rejects the asset, determining whether it moves to the active assets array or is rejected.
Using the pending assets array ensures that additions and changes can be verified, protecting the token and maintaining transaction transparency. The mechanism allows token owners or approved entities to review the asset before it moves to the active assets array.
Parameters
tokenIds- Array of IDs of the tokens receiving the new pending asset.
assetId- ID of the added asset.
replacesId- ID of the asset to be replaced.
AssetAccepted
Overview An event indicating that an asset has been accepted by a token and moved from the pending assets array to the active assets array.
Parameters
tokenId- ID of the token that accepted the new asset.
assetId- ID of the accepted asset.
replacesId- ID of the asset to be replaced.
AssetRejected
Overview An event indicating that an asset has been rejected by a token and removed from the pending assets array.
Parameters
tokenId- ID of the token for which the asset was rejected.
assetId- ID of the rejected asset.
AssetPrioritySet
Overview An event indicating that a token's asset priority array has been rearranged.
The asset priority array is one of the concepts used in ERC-5773 context-dependent multi-asset tokens. It is an array that token owners or approved entities use to set priorities for the active assets associated with a token.
Specifically, the asset priority array indicates the relative priority of the active assets.
Each active asset is assigned a priority represented by an integer value, usually uint16.
This priority indicates an active asset's importance or ordering.
Token owners or approved entities use the asset priority array to change the priorities of active assets. A token owner can set this array to rearrange the priorities of the active assets. This allows the display order and relative ordering of assets to be adjusted.
The benefit of the asset priority array is that token owners or approved entities can control the display and order of active assets. They can make certain active assets more prominent than others or place important assets first.
Parameters
tokenId- ID of the token whose asset priority array was updated.
ApprovalForAssets
Overview An event indicating that an owner has granted a user approval to manage a token's assets.
Parameters
owner- Address of the account granting approval.
approved- Address of the account authorized to manage assets.
tokenId- ID of the token for which approval was granted.
The following sections describe the events and functions.
acceptAsset
Overview A function that accepts a pending asset as an active asset of the specified token.
Details Moves a pending asset into the token's active assets. Active assets cannot be deleted, but they can be replaced with new assets.
Arguments
tokenId- ID of the token accepting the asset.
index- Index in the pending assets array.
assetId- ID of the asset expected at that index.
Return value None
rejectAsset
Overview A function that rejects a pending asset of the specified token and removes it from the pending assets array.
Arguments
tokenId- ID of the token for which the asset is rejected.
index- Index in the pending assets array.
assetId- ID of the asset expected at that index.
Return value None
rejectAllAssets
Overview A function that rejects all pending assets of the specified token and clears the pending assets array.
Arguments
tokenId- ID of the token whose pending assets will be cleared.
maxRejections- A limit that prevents the rejection of assets that arrived immediately before this operation.
Return value None
setPriority
Overview A function that sets the priorities of the specified token's active assets.
Details
Sets the priorities of the specified token's active assets.
The priority array is a list of nonconsecutive uint16 values, with lower values indicating higher priority.
Arguments
tokenId- ID of the token whose priorities will be set.
priorities- Array of active asset priorities.
- The order of the priority array matches the order of the active assets array.
Return value None
getActiveAssets
Overview A function that retrieves the array of active asset IDs for the specified token.
Details
Retrieves the array of active asset IDs for the specified token.
Active asset data is stored by reference. Call getAssetMetadata to access the data associated with an ID.
Arguments
tokenId- ID of the token whose active asset IDs are being retrieved.
Return value
uint64[] memory- Array of active asset IDs for the specified token.
The following sections describe the remaining events and functions.
Event or function: getPendingAssets
Overview Retrieves the array of pending asset IDs for the specified token.
Details
This function retrieves the array of pending asset IDs for the specified token. Asset data is stored by reference, and getAssetMetadata can be called to access the data associated with an ID.
Arguments
tokenId: ID of the token whose pending asset IDs are being retrieved.
Return value
uint64[] memory: Array of pending asset IDs for the specified token.
Event or function: getActiveAssetPriorities
Overview Retrieves the array of active asset priorities for the specified token.
Details
This function retrieves the array of active asset priorities for the specified token. The priority array contains nonconsecutive uint16 values corresponding to the priorities of the active assets.
Arguments
tokenId: ID of the token whose active asset priorities are being retrieved.
Return value
uint64[] memory: Array of active asset priorities for the specified token.
Event or function: getAssetReplacements
Overview Retrieves the ID of the asset that would be replaced if a pending asset of the specified token were accepted.
Details
This function retrieves the ID of the asset that would be replaced upon acceptance of the specified token's pending asset. Asset data is stored by reference, and getAssetMetadata can be called to access the data associated with an ID.
Arguments
tokenId: ID of the token being checked.newAssetId: ID of the pending asset to be accepted.
Return value
uint64: ID of the asset to be replaced.
Event or function: getAssetMetadata
Overview Retrieves the metadata of the active asset at the specified index for a given token.
Details This function retrieves the metadata of the active asset at the specified index for a given token. It can also be overridden to implement custom logic.
Arguments
tokenId: ID of the token whose asset metadata is being retrieved.assetId: ID of an active asset, expected to identify the relevant asset.
Return value
string memory: Metadata of the active asset at the specified index for the given token.
Event or function: approveForAssets
Overview Grants a user permission to manage a token's assets.
Details This function grants a user permission to manage a token's assets. Unlike transfer approval, this approval is not cleared when assets are accepted, rejected, or reprioritized. It is, however, cleared when the token is transferred.
Arguments
to: Address of the account receiving approval.tokenId: ID of the token for which asset management permission is granted.
Return value None
getApprovedForAssets
Overview A function that retrieves the address of the account authorized to manage the specified token's assets.
Arguments
tokenId- ID of the token for which management permission is being checked.
Return value
address- Address of the account authorized to manage the specified token's assets.
setApprovalForAllForAssets
Overview A function that adds or removes an asset operator for the calling account.
Details
This function adds or removes an asset operator for the calling account.
An operator can call acceptAsset, rejectAsset, rejectAllAssets, and setPriority for any token owned by the caller.
Arguments
operator- Address of the account whose operator role is being granted or revoked.
approved- Boolean indicating whether to grant (
true) or revoke (false) the operator role.
- Boolean indicating whether to grant (
Return value None
isApprovedForAllForAssets
Overview A function that checks whether a specified account has been granted an asset operator role by a particular account.
Arguments
owner- Address of the account that granted the operator role.
operator- Address of the account whose operator role is being checked.
Return value
bool- Boolean indicating whether the specified account has been granted an asset operator role by the particular account.
The getAssetMetadata function returns an asset's metadata URI.
The metadata referenced by an asset's metadata URI can contain a JSON response with the following fields.
{
"name": "Asset Name",
"description": "The description of the token or asset",
"mediaUri": "ipfs://mediaOfTheAssetOrToken",
"thumbnailUri": "ipfs://thumbnailOfTheAssetOrToken",
"externalUri": "https://uriToTheProjectWebsite",
"license": "License name",
"licenseUri": "https://uriToTheLicense",
"tags": ["tags", "used", "to", "help", "marketplaces", "categorize", "the", "asset", "or", "token"],
"preferThumb": false, // A boolean flag indicating to UIs to prefer thumbnailUri instead of mediaUri wherever applicable
"attributes": [
{
"label": "rarity",
"type": "string",
"value": "epic",
// For backward compatibility
"trait_type": "rarity"
},
{
"label": "color",
"type": "string",
"value": "red",
// For backward compatibility
"trait_type": "color"
},
{
"label": "height",
"type": "float",
"value": 192.4,
// For backward compatibility
"trait_type": "height",
"display_type": "number"
}
]
}This is the recommended JSON schema for asset metadata, but it is not mandatory. Implementers may choose an entirely different structure.
Additional notes
Should the token's structure be called an Asset or a Resource?
The original name under consideration was Multi-Resource, but the proposal describes a single token with multiple structures. The term Asset is therefore more appropriate. An asset is something owned, such as money or real estate. In this proposal, the term covers the range of assets an implementer can incorporate into a token, including multimedia files, technical information, and land title deeds.
Why not use EIP-712 permit-style signatures?
Because the proposal extends the existing ERC-721 standard, approving token operations already requires a transaction. Adding message signatures in this proposal would be inconsistent with that approach, so EIP-712-style signatures are not adopted.
Why use indexes?
Finding a specific asset by ID would require iterating through an array, making the cost of the operation depend on the number of active or pending assets. Using indexes keeps the operation's cost constant. Each token must maintain lists of active and pending assets, and indexes allow efficient access to those lists for each token. To avoid race conditions, the corresponding asset ID is also supplied when operating on an asset, ensuring the intended asset is being modified.
Why is there no method for retrieving all assets?
Not every implementer necessarily needs this operation. It can also be added as an extension or simulated using hooks.
Why is pagination not included?
Asset IDs use uint64, and the number of readable IDs is limited to approximately 30,000.
Pagination was therefore considered unnecessary for common use cases.
Implementers can add their own pagination functionality if needed.
How does this proposal differ from others addressing similar problems?
The proposal differs from other approaches to similar problems in the following ways.
1. Using a single URI
Other proposals update a single URI whenever a new asset is required. However, this can create trust issues for token owners. In other words, replacing the URI may switch the asset to one the owner did not intend to receive.
2. Focusing on particular asset types
Other proposals focus on particular asset types and apply only to those types of assets. This proposal is asset-agnostic and is designed to work with many different kinds of assets.
3. Using separate tokens for different use cases
Other proposals create and provide a different token for each new use case. However, this creates future compatibility problems. When new use cases emerge, existing tokens cannot support them, requiring new tokens to be created.
To address these limitations, the proposal emphasizes the following points.
- To address trust issues, it provides a mechanism for adding or changing assets according to the token owner's wishes rather than simply switching a URI to replace the asset.
- Its design is not tied to a particular type of asset and flexibly supports different asset types.
- Rather than creating new tokens for different use cases, it extends the same token to ensure future compatibility.
Multi-asset storage schema
The proposal uses arrays of uint64 identifiers to store assets within tokens.
Assets are stored through internal storage that references the asset data.
Asset entries are saved in storage associated with asset data through a uint64 mapping.
An asset array serves as an array of references to these uint64 asset IDs.
This structure stores the underlying asset data only once, after which references to the asset can be added multiple times within the token contract.
This reduces redundant strings in storage and enables efficient data management.
Implementers can use string concatenation to procedurally generate links to content-addressed archives from the underlying asset data and token ID.
Storing an asset in a new token requires 16 bytes of storage per asset within the asset arrays.
This approach enables efficient sharing and reuse of assets.
The proposal uses arrays of uint64 identifiers so that tokens can hold multiple assets.
Rather than storing asset contents directly in each token, asset data is stored through a uint64 mapping associated with internal storage.
Consider a virtual token (NFT), for example.
The token holds several assets, such as artworks and music files.
Each asset is identified by a unique uint64 identifier (an asset ID).
Rather than storing the asset's actual data directly in the token, an asset ID referring to the asset contents is associated with it. The token maintains an array of asset IDs. Each element of this array is an asset ID pointing to the actual asset.
Consider the following example.
- Token ID:
1001 - Asset IDs:
2001,2002 - Token ID:
1002 - Asset IDs:
2001,2003
Here, asset ID 2001 is shared by two tokens (1001 and 1002).
However, the actual asset data is stored in one place, referenced by asset ID 2001.
This approach eliminates redundant data when multiple tokens share the same asset and enables efficient data management.
A URI can also be generated procedurally using an asset ID when associating the asset with a specific token. This makes it possible to generate different links for each token according to the asset's content or type.
Propose-commit pattern for adding assets
Adding an asset to an existing token uses a process combining proposal and commit steps. First, the new asset is added to the pending assets array. The token owner then moves it from pending to active status. This approach not only places asset addition under the token owner's control but also helps prevent spam and abuse. The number of slots in the pending assets array is also limited to prevent excessive asset additions.
Asset management
The proposal includes several functions for managing assets. In addition to allowing assets to move from pending to active status, it describes how token owners can remove assets from the active and pending arrays. It also provides an emergency function for clearing every entry in the pending assets array. This enables token owners to manage assets effectively and maintain the token's integrity.
Backward compatibility
The multi-asset token standard is compatible with ERC-721.
Tests
The test files are available at the following location.
Source: https://eips.ethereum.org/EIPS/eip-5773
Reference implementation
The code is available at the following location.
Source: https://eips.ethereum.org/EIPS/eip-5773
Security considerations
This proposal requires security precautions similar to those for ERC-721. Be aware that the proposed functions, such as those for removing tokens, adding assets, and approving assets, may contain unexpected hidden logic. These functions should be implemented carefully to prevent unintended changes to contract behavior or unauthorized operations.
Particular care is also required when interacting with unaudited contracts. Contracts that have not been sufficiently audited may contain security vulnerabilities or other problems. Interactions with these contracts should therefore be approached cautiously. Prioritize interacting with trustworthy contracts to avoid unexpected risks such as unauthorized operations or data leakage.
References
Bruno Škvorc (@Swader), Cicada (@CicadaNCR), Steven Pineda (@steven2308), Stevan Bogosavljevic (@stevyhacker), Jan Turk (@ThunderDeliverer), "ERC-5773: Context-Dependent Multi-Asset Tokens," Ethereum Improvement Proposals, no. 5773, October 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5773.
Discussion
I find it interesting that this standard can switch which assets are provided across different media and metaverses.
It initially reminded me of ERC-4955, which allows the tokenURI provided for each metaverse to change. However, this proposal lets the contract switch which asset (NFT) it provides, so the two standards might even be used together.
[ERC-4955] Applying NFTs across Multiple Metaverses
It also seems interesting to notify users about NFT evolution or design changes and let each user decide whether to accept them.
However, this appears to change the NFT being provided rather than changing the design within a single NFT (that is, switching its tokenURI), which may introduce various challenges.
It might be possible to design an implementation that switches the metadata itself. I may need to extend the standard, or I may simply have misunderstood it, so I intend to experiment with it.
Conclusion
This article covered ERC-5773, a proposal that changes NFT output formats by switching the assets provided according to the medium through which they are accessed. I hope the explanation was helpful.
If you have questions, feel free to contact me via Twitter DM.

