Open In App

How Does NFT Metadata Works?

Last Updated : 15 Mar, 2023
Like Article

The NFT metadata is used in the blockchain to provide additional information or data about an asset that may be useful when trying to complete a transaction with the asset itself. There are a couple of issues that have been brought up:

  • The first is the transparency blockchain provides, and how many blockchains can be used at one time. 
  • The second is how tokens are transacted between different blockchains. 

These two issues are related because data can be taken from one chain, transferred to another chain over encrypted channels, then converted when it’s accepted by the destination chain. This NFT metadata can be stored in the blockchain in which the token resides and can be used as a source of truth on an asset, while also providing additional useful information. 

The following topics will be discussed here:

  1. How is NFT Metadata Used?
  2. How does NFT Metadata Work?
  3. How is NFT Metadata Stored?
  4. Applications of NFT Metadata
  5. Conclusion

Let’s start discussing each of these topics in detail.

How is NFT Metadata Used?

NFT Metadata can be used for many things including: 

  • Providing a source of truth.
  • Providing additional values (price, image, description, etc.) about an asset.
  • Enabling decentralized data storage. 
  • Helping when performing transactions between chains or records that are stored off-chain (on centralized servers like IPFS or other use cases).

How Does NFT Metadata Work?

Blockchain is an incredible invention but the question still lingers in everyone’s minds about how does NFT metadata work in blockchain? What are the primary benefits of using decentralized NFT protocols?

  • Blockchain is one of the most secure ways to store digital assets and perform transactions with them.
  • The tokens are essentially a virtual representation of value that can be transferred peer-to-peer. This value is stored in a network secure and distributed manner, free from the interference of banks, governments, and other third parties, who typically control and manage fiat currency.
  • The NFT metadata transfers necessary information such as the code of the smart contract and event data from Ethereum (Ethereum-based subchain). The NFT metadata can send information to clients when they want to check the status of the asset or even transfer them to other accounts. It can connect the Ethereum chain to a centralized blockchain system if needed.
  • NFT metadata needs to be decentralized as well as blockchain technology itself, which means that we’ll need a consensus algorithm capable of keeping both systems secured

How is NFT Metadata Stored?

The way NFT metadata is stored depends on what blockchain network it resides in. 

  • There are different consensus mechanisms used in blockchain that dictate how data is stored. In a distributed ledger, the metadata can be stored in a number of ways depending on the blockchain type (whether it’s public or private) and how it was created. 
  • In public blockchains, the most common way metadata is stored is through a Merkle Tree Root which is also known as a tree hash.
  • A merkle tree root is an unbalanced binary hash tree where all nodes above the leaf nodes have values only from left child nodes. The root node contains all of these leaf nodes combined together and then hashed to create one hash value – referred to as “merkle root”. The root node is linked to its child nodes through the child node’s hash value. Each child node contains its parent’s hash value, and so on and so forth until the leaf nodes are reached. The leaf nodes are then hashed to create a new merkle root which is then recorded into the blockchain.
  • When data is stored in a distributed ledger, it must be signed by an owner of the data or a “private key” (or multiple keys) before it can be written into the ledger. A private key is a number that only an owner of a specific piece of data knows so that their data can only be read by them. A private key makes it possible for the owner of a piece of data to read their own data in the distributed ledger.

Only a public key is needed, which everyone else knows, to be able to read the data. Everyone uses this public key when trying to read all the data in a database without having permission to do so. This is why we have database systems that have provisions for permissions and owners of the database can control who has access to the database and what they can do with it – because there are always people who are not properly authorized who might wish to sneak into your database.

Example :- In public blockchain if you want to store the metadata of ERC-721 Token on Pinata( then first you can upload the image of that NFT on Pinata, generate the CID and paste it in the animation_url while creating the metadata.json file like this :


   "name": "GeeksForGeeks NFT",
   "description": "GFG NFT for Developers",
   "image": "/home/jitendra-rv/Downloads",
   "animation_url": "ipfs://ZmVsmKU1PwvrqvzwzLTK9DRa44N7G4jbiPSpGXUTrNKMor"

According to EIP721, In this metadata.json file must have name, description and image. Once the metadata.json file is created, you can upload it on Pinata and generate the CID. If you want to mint this NFT then you can copy the generated CID from Pinata and paste it in your ERC-721 smart contract. 

Applications of NFT Metadata

  • NFT Metadata can be used for a variety of use cases. For example, it can be used to record an additional description of a token (possibly like a receipt or serial number) that makes it easier when performing transactions or could provide extra information about the asset itself (like the price, image, or current location). 
  • There are also use cases such as storing state data off of the blockchain, which can be useful in computers with limited bandwidth or storage. In this scenario, metadata data is sent to centralized servers and can then be accessed on the blockchain when wanted through an encrypted channel.

Conclusion: In summary, when a piece of data is stored in a blockchain, it can be signed by the owner of that data and then recorded into the blockchain. When data is stored on a server or in a centralized database, the owner of the data must give authorization for other people to read their files (they do this through their private keys). In contrast with public blockchains, users under restrictions or controls can store metadata directly on a blockchain.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads