ERC-5625 NFT metadata decentralized storage information extension (NFT Metadata JSON Schema dStorage Extension)
Final · Names & metadata · created 2022-09-08
Adds a dStorage property to the NFT metadata JSON so that it can indicate which decentralized storage, and how, holds the image and other assets the NFT points to.
Why it is needed
Ownership records of an NFT are kept on the blockchain through an EIP-721 or EIP-1155 smart contract, but the asset files the NFT actually points to, such as images, are stored outside the blockchain. Because these are high-value assets, these files should also sit in storage that guarantees immutability, reliability and durability, yet neither the existing EIP-721 and EIP-1155 metadata schemas nor the metadata format that OpenSea defined and that is used as a de facto standard has any field that says where and how the asset is stored. This proposal fills that gap by adding a storage information field to the metadata JSON.
In depth
Scope and method
This is an extension that adds one dStorage property to the metadata JSON file returned by the tokenURI method of EIP-721 and the uri method of EIP-1155. It is specified as OPTIONAL under RFC 2119, so omitting it is not a standard violation, and existing properties such as name, description and image are kept as they are. There is no change to the contract interface.
The 6 required fields of the dStorage object
If a dStorage object is included, all six fields are required. platform is the name of a decentralized storage platform such as Swarm, Arweave, Filecoin, or Crust, and description is a short description of that platform. persistence_mechanism is the persistence or incentive structure, such as 'blockchain-based' or 'contract-based'. challenge_mechanism is the verification method, such as Arweave's proof-of-access. consensus is the consensus method, such as PoW or PoS. dstorage_note holds a note that proves actual storage, such as a Filecoin deal id or the hash of a Crust place_storage_order transaction.
Added identically to the EIP-721 and EIP-1155 schemas
A dStorage property with the same structure is added to both the EIP-721 metadata schema (name, description, image) and the EIP-1155 metadata schema (name, decimals, description, image, properties, localization, and others). In both schemas, the sub-fields of dStorage and the required list are identical.
Why a JSON schema extension instead of an interface extension
Extending the contract interface of EIP-721 or EIP-1155 requires writing additional implementation code, and NFT projects that have already finalized and deployed their contracts cannot use it. An optional JSON schema extension is a non-invasive approach that does not touch the contract, so it is easier to adopt, according to the original text. For the same reason, this proposal is backward compatible with EIP-721 and EIP-1155.
A gap in existing standards
The EIP-721 metadata schema defines three properties: name, description, and image. EIP-1155 adds decimals, properties, localization, and others. The metadata standard defined by OpenSea adds image_data, external_url, attributes, background_color, animation_url, youtube_url, and more, and other marketplaces such as LooksRare follow it. However, none of these carries storage information for the asset file an NFT points to, and this proposal tries to fill that gap. The original text's status is Final, so it is a finalized standard.
Things to watch out for
- Informational field, so no new risk: dStorage is only an informational field in the metadata JSON and does not affect the execution or validity of NFT transactions. The original text states that it creates no new security risks or vulnerabilities.