All you Need to know About NFT Metadata

All you Need to know About NFT Metadata

Prerequisite:

1. Basic blockchain knowledge
2. Programming knowledge (JSON)

Introduction

What is NFTs?

NFT → Non-Fungible Token can be defined as a unique asset stored on blockchain which someone can own. It’s different from the regular tokens(Cryptocurrencies) on blockchain which can have supply of more than one.
More professionally:
Non-fungible tokens (NFTs) are assets like a piece of art, digital content, or video that have been tokenized via a blockchain

You can check out the popular nfts on nft marketplace.

  1. Opensea:- opensea.io

  2. Zora:- zora.co

What is the role of metadata in NFTs?

If you go to one of the NFT marketplace i gave you above and open any NFT you can see the image, Description, traits, name, floor price, creator like details on that NFT page.
these data is being fetched from the NFT metadata file using the URI of that particular NFT token which contains the metadata of the NFT.

In nutshell that NFTs are the tokens on blockchain which represent an unique asset and the data about that asset is stored in the NFT metadata file using the standard format to help recognising the data for NFT marketplace.

Importance of understanding NFT metadata

NFT metadata is crucial part of any NFT as it contains the essential information of the NFTs.
If you can understand the NFT metadata you can understand the asset. it has description of F which can contain the significance of the NFT.

Following are some of the use of metadata in different field:

  • Gaming industry:
    NFTs generally being used in gaming field as gaming items so it can have different traits or the characteristic. These traits or characteristics are listed in NFT metadata.

  • Airdrop:
    Sometimes NFTs are being used as Airdrop tickets. So it will have description of how to redeem the airdrop in NFT metadata description

  • Decentralize certification:
    NFTs can be used as certificates where essential information of Certificate is stored in the NFT metadata.

Understanding NFT Metadata

Definition/structure of metadata:

There is not any standard structure of metadata the one has to follow. Anyone can add any important data they want in their metadata file but Marketplace has some standard structure defined that one can follow so it will be easier for Marketplace to show the NFT on thier platform with the uri metadata file data.

Opensea has documented this structure you can explore it here:
https://docs.opensea.io/docs/metadata-standards

I’ll quickly explain it here. Metadata JSON file should have following fields that marketplace can show on their platform:

{
  "description": "Friendly OpenSea Creature that enjoys long swims in the ocean.", 
  "external_url": "https://openseacreatures.io/3", 
  "image": "https://storage.googleapis.com/opensea-prod.appspot.com/puffs/3.png", 
  "name": "Dave Starbelly",
  "attributes": [ ... ]
}

How to get the metadata file for an NFT?

For Ethereum-based tokens, the smart contract that governs an NFT usually specifies the location of the metadata using a function:

  • For the ERC721 standard function tokenURI(uint256 _tokenId) external view returns (string memory)
  • For the ERC1155 standard: function uri(uint256 _id) external view returns (string memory)

The value returned by this function is often a URL that gives you metadata JSON file.

How to store NFT metadata file?

There are mainly two ways you can store the nft metadata json file:

1. On Centralized Storage

Metadata file is stored in Google Cloud, Amazon Web Services, or some other form of centralized storage.
But there are two problems with these storage providers:

  • Impermanence: The server can go down or offline, making it hard to find the image (unless it was mirrored by an NFT index like OpenSea).

  • Mutability: The developer can modify the image to something a collector does not expect.

2. On Decentralized Storage
Metadata file is stored in decentralized storage solutions like IPFS, Filecoin and Arweave, which replicate metadata across storage nodes in a decentralized network.

Types of Metadata Storage

There are four types of metadata storage for NFTs. Here’s a handy grid:

Here frozen means that even if decentralized storage data can be mutate by doing transaction. So We call NFTs that have unchangeable metadata “frozen”.

Let’s understand them individually:

  1. Centralized: Most NFTs have a function on their smart contract to return the metadata associated with a particular token identifier. The result is often a URL on a web server run by the developer (e.g. example.com/nft/2). When the properties and media of an NFT are all controlled by a server like this, the NFT is centralized, and will be subject to impermanence and mutability problems.

  2. Centralized and verifiable: One of the earliest NFTs, CryptoPunks by Larva Labs, stores its images in a centralized server. However, the smart contract stores the hash of this image in the smart contract. This means that while CryptoPunks may be subject to impermanence, any modification to its images can be checked against this hash, so we can “verify” if a CryptoPunk image is original or modified.

    Other projects, like CrypoKitties, have variations of this system, such as storing NFT traits on-chain but renderings of the traits in a centralized server. In this variation, the images can be modified, but the kitty “genes” and rarity information cannot.

  3. Decentralized: Instead of storing metadata in a central server, developers have the option to store it directly in the smart contract or in a file-friendly decentralized network. Two of the best options are IPFS with Filecoin and Arweave.

    Arweave requires miners to refer to data that was previously stored, similar to a blockchain (called their “blockweave”). IPFS allows peers to store, request, and transfer verifiable data with each other, and can be used with Filecoin to incentivize miners to continue storing data persistently with verifiable proofs.

    An example of this kind of project is Bored Ape Yacht Club. The metadata is stored in IPFS, though the root URI used for IPFS is changeable by the contract owner.

  4. Decentralized and frozen: It’s tricky to know when an NFT’s metadata is frozen or not, as there are usually multiple ways of changing it. This is a manual process, but OpenSea now shows when NFTs made on OpenSea have been frozen and when many NFTs outside of OpenSea are immutable as well:

    Clicking “Frozen” above takes you to the decentralized URI for the item if it’s on a file storage network, supporting IPFS and Arweave (including ipfs:// and ar:// URLs).

Some examples of decentralized and frozen projects include:
SuperRare (IPFS)
Sandbox (IPFS)
Uniswap (on-chain)
1111 by Kevin Abosch (Arweave)

TLDR :

In conclusion, understanding NFT metadata is essential for anyone involved in the NFT ecosystem, as it provides critical information about the asset, such as its description, traits, and provenance. Metadata plays a vital role in various applications, including gaming, airdrops, and decentralized certification. The storage of NFT metadata can be centralized or decentralized, each with its own advantages and challenges. Centralized storage is prone to issues like impermanence and mutability, while decentralized storage offers more security and permanence, especially when metadata is "frozen." As the NFT space continues to evolve, the importance of robust and reliable metadata storage solutions will only grow, ensuring the integrity and authenticity of digital assets.