ERC-7603 ERC-1155 Multi-Asset Extension
Draft · NFTs & multi-token · created 2024-01-25
An ERC-1155-compatible extension that lets multiple assets (files) be attached to a single token collection with assigned priorities, so they can be displayed in a format suited to the accessing environment, such as an e-book reader, marketplace, or game.
Why it is needed
Because ERC-1155 tokens typically point to only a single output, the same token ends up showing the identical file whether it is opened in an e-book reader, a marketplace, or loaded in a game. A cosmetic item for Game A cannot be used in Game B, which has a different framework, and game developers have to hardcode the asset information directly. In addition, many tokens are minted in haste with metadata hosted only on a single central server or a specific IPFS gateway, so if that one location goes down, all the information the token points to is cut off. This standard allows multiple assets in different formats to be attached to a single token collection and sorted by priority, enabling context-specific output and storage redundancy.
What to implement
event AssetSet(uint64 assetId);: Signals that an asset object has been initialized with an assetId.event AssetPrioritySet(uint256 indexed tokenId);: Signals that a token's priority array has been reordered.function setPriority(uint256 tokenId, uint64[] calldata priorities) external;: Newly sets the priority array for a token's assets. A lower value means higher priority.function getAssets(uint256 tokenId) external view returns (uint64[] memory);: Returns the array of asset IDs attached to a token.function getAssetPriorities(uint256 tokenId) external view returns (uint64[] memory);: Returns the priority array of a token's assets.function getAssetMetadata(uint256 tokenId, uint64 assetId) external view returns (string memory);: Returns the metadata string corresponding to a specific asset for a given token.
In depth
Asset model: namespaced tokenURIs
A token collection can have multiple assets (outputs); an asset can be any kind of file, and they are sorted by priority. Assets need not share the same MIME type or tokenURI with each other, nor depend on one another. The source text explains that assets should be understood not as independent entities but as namespaced tokenURIs. This way, when a token is opened in an e-book reader a PDF is selected, in a marketplace a PNG or SVG, inside a game a 3D model, and on an IoT hub an asset containing address and specification information, so that the format appropriate to the access method is chosen.
setPriority and priority rules
setPriority(tokenId, priorities) newly sets a token's priority array. Priorities are a list of non-contiguous values where a lower value means higher priority, and 0 is a special value meaning uninitialized. tokenId must exist, the length of priorities must equal the length of the asset array, and an AssetPrioritySet event is emitted on execution. Note that while the comments describe priorities as a list of uint16, the function signature's argument and the return type of getAssetPriorities are declared as uint64[].
Three query functions
getAssets(tokenId) returns the array of asset IDs (uint64[]) attached to a token. Since asset data is stored by reference, the actual content must be retrieved by calling getAssetMetadata(tokenId, assetId). getAssetPriorities(tokenId) returns the asset priority array. getAssetMetadata is specified as returning the metadata string for the given asset, and it may be overridden to add custom logic such as enumeration or fallback behavior. assetId must be present in that token's asset array.
Three events
AssetSet(assetId) is emitted when an asset object is initialized. AssetAddedToToken(tokenId, assetId, replacesId) is emitted when an asset is added to a token's asset array, where replacesId refers to the ID of the asset being replaced. This event's tokenId argument is declared as a uint256 array (uint256[]). AssetPrioritySet(tokenId) is emitted when a token's priority array is reordered.
Three motivations for use
The original lists three improvement areas. First, cross-metaverse compatibility: a single token can hold a cosmetic asset file for Game A, an asset file for Game B, and generic assets for catalogs, marketplaces, and portfolio trackers (stylized thumbnails, animated demos, etc.), letting game developers pull asset data directly from a user's token instead of hardcoding it. Second, multimedia output: an ebook token can be rendered as a PDF in an ebook reader and as an MP3 in an audiobook app. Third, media redundancy: registering the same metadata and image combination as separate assets across multiple protocols such as Arweave, Sia, and IPFS lowers the chance that all protocols go down at once, increasing resilience.
ERC-1155 Compatibility
This standard is built to be compatible with ERC-1155, so it can reuse the robust tooling already built for ERC-1155 implementations and guarantee compatibility with existing ERC-1155 infrastructure. Per the preamble's requires section, it presupposes ERC-165 and ERC-1155, and the interface comments also note that it inherits ERC-165.
An Unfinished Proposal in Draft Status
This proposal is in Draft status. The original's Rationale section is left as TBD (to be determined), and the Security Considerations section only states that discussion is needed, so there is no security guidance yet. Since the content is a draft that may still change, this should be kept in mind when implementing or referencing it.