主页EIPs周刊
EIPsERC-7280
ERC-7280

NFT Metadata Extension like JSON-LD

Let NFT metadata have a feature equivalent to JSON-LD to be semantic.
DraftStandards Track: ERC
创建时间: 2023-07-04
关联 EIP: EIP-721, EIP-1155, EIP-3525
Yohei Nishikubo (@yoheinishikubo)
社区讨论原文链接编辑
1 分钟了解
欢迎补充好内容
去提交
相关视频
欢迎补充好内容
去提交
正文

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.

namecompliance leveltypedescription
schemaMUSTobjectThe schema of the linked data.
dataMUSTobjectThe data of the linked data.

Schema

namecompliance leveltypedescription
uriMUSTstringThe URI of the schema.
nameMUSTstringThe name of the schema.
descriptionOPTIONALstringThe description of the schema.

Data

namecompliance leveltypedescription
uriMUSTstringThe URI of the data.
langOPTIONALstringThe language of the data. IETF language tag like en-US.
nameOPTIONALstringThe name of the data.
descriptionOPTIONALstringThe 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:

{ "name": "NFT Name", "description": "This NFT represents...", "image": "https://example.org/images/nft.png", "linked_data": [ { "schema": { "name": "VideoObject", "uri": "https://example.org/schemas/VideoObject.json" }, "data": { "uri": "https://example.org/data/video1.json" } }, { "schema": { "name": "MusicRecording", "uri": "https://example.org/schemas/MusicRecording.json" }, "data": { "uri": "https://example.org/data/music1.json" } }, { "schema": { "name": "GoogleTravelImpactModel", "uri": "https://example.org/schemas/GoogleTravelImpactModel.json" }, "data": { "uri": "https://example.org/data/gtim1.json" } } ] }

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

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 and related rights waived via CC0.

扩展阅读
欢迎补充好内容
去提交
相关项目
欢迎补充好内容
去提交

不想错过最新的 EIP 动态?

订阅 EIPs Fun 周刊以跟进相关更新,建⽴你与 EIP 之间的连接 ,更好地建设以太坊。

详情
支持以太坊贡献者,推动生态建设
资源
GitHub
支持社区