ERC-6785 NFT utility information extension (ERC-721 Utilities Information Extension)
Draft · NFTs & multi-token · created 2023-03-27
An ERC-721 extension standard that allows the benefits (utility) attached to an NFT and how to use them to be checked through the NFT's own functions and metadata.
Why it is needed
Sometimes buying an NFT comes with benefits such as video calls or access passes. Currently, however, this benefit information is not recorded on chain, so owners must rely on external platforms to check what the benefit is and how to use it. The source points out that this reliance on third parties can lead to harm such as scams or phishing. Also, the address containing instructions for using the benefit may change over time, and without a record of such changes, it is hard to verify whether the issuer is keeping its promises. This standard aims to increase transparency and issuer accountability by including the type, description, count and duration, and expiry of the benefit in metadata, and by defining a function to look up the history of changes to the instruction address.
What to implement
event UpdateUtility(uint256 indexed tokenId, string utilityUri);: An event emitted when an NFT's utility instruction address changes. An empty string means there is no associated utility.function setUtilityUri(uint256 tokenId, string utilityUri) external;: Sets a new utility instruction address for the given NFT. Fails if the tokenId is invalid.function utilityUriOf(uint256 tokenId) external view returns (string memory);: Returns the current utility instruction address for the given NFT. An empty string means there is no utility.function utilityHistoryOf(uint256 tokenId) external view returns (string[] memory);: Returns the entire history of changes to the utility instruction address for the given NFT.
In depth
Interface and identifier
Contracts following ERC-6785 MUST implement the IERC6785 interface. The interface consists of three functions, setUtilityUri, utilityUriOf, and utilityHistoryOf, and the UpdateUtility event. supportsInterface MUST return true when called with ed231d73. Functions defined as view can be implemented as pure or view.
Permissions and event rules for setUtilityUri
setUtilityUri can be implemented as public or external. It is RECOMMENDED that the permission to set utilityUri be restricted to the party providing the utility, which may be the NFT creator or someone else. An empty string means there is no utility, and the call should fail for an invalid tokenId. The UpdateUtility event MUST be emitted not only when setUtilityUri is called, but also whenever the utility changes through other means such as a batch update.
Completeness requirement for utilityHistoryOf
utilityHistoryOf MUST reflect every change made to the utilityUri of the given tokenId. This includes changes made via setUtilityUri as well as changes made through other means such as batch updates. The reason for keeping this history is transparency, so that anyone can verify how the instruction address has changed over time.
Utility metadata schema
It is RECOMMENDED that metadata follow the 'ERC-6785 Metadata with utilities JSON Schema', which extends the ERC-721 metadata JSON schema. The utilities object requires type (utility type), description (brief description), and t&c (terms and conditions), and can additionally include properties (an array of detailed key-value attributes) and expiry (validity period from mint time, in seconds). In the source example, a video call benefit is expressed with attributes such as sessions 2, duration 30, and time_unit minutes.
Why the instruction address can be changed
utilityUri may contain information that needs some level of access restriction, and its display may depend on off-chain tools. Since the creator needs to be able to replace the address if that tool or platform becomes unusable, an update function was included. Owners visit this address to obtain detailed information needed to use the benefit, and access can be conditioned on authentication with the wallet holding the NFT. Current status, such as remaining uses, is also included at this address.
Compatibility and proposal status
This standard is compatible with the current ERC-721, and the source states that no other standard defines similar functions and that the function names do not overlap with other ERC-721-related standards. However, this proposal is still in Draft status, so its content may change or progress may stall.