ERC-7280 NFT metadata linked data extension (NFT Metadata Extension like JSON-LD)

Draft · Names & metadata · created 2023-07-04

A standard that adds a linked_data key to NFT metadata, allowing structured semantic data such as JSON-LD (Linked Data) to be linked to it.

Why it is needed

The existing metadata formats of NFT standards such as ERC-721 and ERC-1155 are limited, leaving no way to include structured, unambiguous data. Since there is no place to record, in a machine readable form, what video or music an NFT represents, it is difficult for search engines to properly read the NFT's content or for other applications to use NFT metadata as a data source. The web has addressed this problem with a format called JSON-LD, but there was no standard location for it in NFT metadata. This proposal adds a key called linked_data to the metadata JSON so that external schemas and data can be linked, improving the richness and interoperability of NFT metadata. When complex metadata structures are linked to external schemas and data, the context and usefulness of an NFT improve across many applications.

In depth

Structure of the linked_data key

JSON-LD based metadata is stored under a new key, linked_data, in the metadata JSON. linked_data is an array of objects, and each object has two keys, schema and data. schema represents the schema of the linked data and data represents the linked data itself; both are MUST and of type object. Because it is an array, a single NFT can have multiple linked_data objects. The reference implementation example includes three objects at once: VideoObject, MusicRecording, and GoogleTravelImpactModel.

Fields of the schema object

The schema object has three fields. uri is MUST and of type string, representing the URI of the schema. name is MUST and of type string, representing the name of the schema. description is OPTIONAL and of type string, describing the schema. In other words, every linked_data entry must state the location and name of the schema it follows.

Fields of the data object

The data object has four fields. uri is MUST and of type string, representing the URI of the data. lang is OPTIONAL and specifies the language of the data using an IETF language tag such as en-US. name and description are both OPTIONAL strings giving the name and description of the data. Rather than embedding the data body directly in the metadata, it is linked by URI.

Scope of application and backward compatibility

This proposal extends the metadata format of non fungible token standards such as ERC-721, ERC-1155, and ERC-3525, referencing all three standards as requires. The extension is backward compatible with existing implementations. NFTs that do not include a linked_data key behave exactly as before, and existing applications that consume NFT metadata are unaffected. This is because it simply adds one key to the metadata JSON without requiring a hard fork.

Design intent: search visibility and interoperability

When building a typical web page for an NFT, this extension makes embedding JSON-LD in HTML header tags much simpler. You just find the uri of a JSON-LD compatible value in the linked_data array, fetch it, and insert the content into the header. This lets the NFT publisher control, for example, how the NFT appears in Google search results. In terms of broader interoperability, because any schema and data can be included, NFT metadata can serve as a data source for any application, and the presence of a schema makes implementation easier.

Usage shown by the reference implementation example

The example metadata contains three linked_data objects, each with a different schema. The first, VideoObject data, can be used as JSON-LD in the HTML header to create rich snippets in Google search results. The second, MusicRecording data, is based on a schema.org schema but does not produce rich snippets. The third, GoogleTravelImpactModel data, uses a schema dedicated to Google's travel impact model. The original text emphasizes that any schema and data can be included under this standard in this way.

Proposal status

This proposal was created on July 4, 2023 and is currently in Draft status. Since it is still an unfinalized draft, its content may change or progress may stall. It is advisable to check the latest source text before implementing.

Things to watch out for

Original ERC · ← ERCs