ERC-7280: NFT Metadata Extension like JSON-LD
Let NFT metadata have a feature equivalent to JSON-LD to be semantic.
Abstract
This proposal expands the metadata format for Non-Fungible Tokens (ERC-721, ERC-1155, ERC-3525, and others), adding support for linked data like JSON-LD format. The additional data is stored under the linked_data key in the metadata JSON.
Motivation
The existing metadata format for Non-Fungible Tokens is limited and doesn't support the inclusion of structured and semantically meaningful data. By integrating JSON-LD (Linked Data), we can enhance the richness and interoperability of the metadata associated with NFTs.
This allows for complex metadata structures that can link to external schemas and data, improving the contextual relevance and usability of NFTs across various applications.
Specification
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.
The JSON-LD based metadata is stored under a new linked_data
key in the metadata JSON. The linked_data
key is an array of objects, where each object contains two keys: schema
and data
.
name | compliance level | type | description |
---|---|---|---|
schema | MUST | object | The schema of the linked data. |
data | MUST | object | The data of the linked data. |
Schema
name | compliance level | type | description |
---|---|---|---|
uri | MUST | string | The URI of the schema. |
name | MUST | string | The name of the schema. |
description | OPTIONAL | string | The description of the schema. |
Data
name | compliance level | type | description |
---|---|---|---|
uri | MUST | string | The URI of the data. |
lang | OPTIONAL | string | The language of the data. IETF language tag like en-US . |
name | OPTIONAL | string | The name of the data. |
description | OPTIONAL | string | The description of the data. |
Rationale
For providing typical webpage for an NFT, it's much simple to include JSON-LD in HTML header tag with this extension. Just looking for JSON-LD compliant value's uri from linked_data
array, fetch it and embed its content in HTML header tag.
This means the minter of NFT can control the appearance in the search result of Google, for example.
In more common case for interoperability, the NFT metadata can include any schema and data with this extension. This means the NFT metadata can be used as a data source for any application. With the schema, the implementation is much easier.
Backwards Compatibility
The proposed expansion to the NFT metadata format is backward compatible with existing implementations. NFTs that do not include the linked_data
key will continue to function as before, and existing applications consuming NFT metadata will not be affected.
Reference Implementation
Here is an example metadata JSON demonstrating the new linked_data structure:
In the example above, the NFT metadata contains three linked data objects, each with a different schema and data:
First one. VideoObject data can be used as JSON-LD in HTML header tag and realize rich snippet in Google search result.
Second one. MusicRecording data is based on a schema from schema.org
. However this one cannot realize rich snippet.
Third one. GoogleTravelImpactModel data is a dedicated schema for Google Travel Impact Model.
The most important point is that any schema and data can be included with this standard like above.
Sample files
- VideoObject.json
- MusicRecording.json
- GoogleTravelImpactModel.json
- video1.json
- music1.json
- gtim1.json
Security Considerations
The proposed expansion does not introduce any additional security considerations beyond those already associated with NFTs and linked data. Implementations should adhere to best practices for secure handling and validation of metadata from external sources.
Copyright
Copyright and related rights waived via CC0.