Skip to main content

Metadata

Formats metadata for minting ZORA NFTs#

In the original ERC-721 specification, it was suggested that tokens should link to a metadataURI that contains a link to the specific content of the NFT. However, in the event that the a creator needed to change the storage location there would be no way to ensure the integrity of both the metadata and content.

ZORA NFTs explicitly separates contentURIs and metadataURIs and provides a sha256 checksum for each. This allows anyone the ability to quickly verify the integrity of the data at any time if a URI has been updated.

In order to allow the ZORA community to integrate with your metadata schema, we provide a media metadata schema repository, that can serve as the source of truth for community supported metadata schemas. They are defined as JSON schemas, and generate Types, Parsers, Generators, and Validators that are automatically served through the ZDK.

Generate Metadata#

Given a schema version and some unformatted JSON, this method generates a valid, minified, and alphabetized JSON object.

import { generateMetadata } from '@zoralabs/zdk'
const metadata = {  version: 'zora-20200101', // The version of metadata you are generating  name: someName,  description: someDescription,  mimeType: someMimeType, // Media type: audio, image, etc etc}
const minified = generateMetadata(metadata.version, metadata)

Validate Metadata#

import { validateMetadata } from '@zoralabs/zdk'
const metadata = {  version: 'zora-20210101',  name: randomName,  description: randomDescription,  mimeType: mimeType,}
const isValid = validateMetadata(metadata.version, metadata)

Parse Metadata#

import { parseMetadata } from '@zoralabs/zdk'
const metadata = `  {    version: 'zora-20210101',    name: randomName,    description: randomDescription,    mimeType: mimeType,  }`const parsed = parseMetadata('zora-20210101', metadata)

Define a new Schema#

To define a new schema, visit the metadata schema repository and follow the instructions in the README.

Further Reading#