NFT Trait Metadata Standard

The term “metadata” relates to the unique identifier data that is associated with a virtual object. Originally used to identify websites content with a domain, in the NFT ecosystem the term is now employed to refer to the unique identifiers of each token. For example, in personal profile picture (PFP) collections the metadata contains a set of tags which identify each trait with a particular attribute for that trait. It is vital that these data are stored efficiently so that an NFT can integrate easily with different platforms across the ecosystem.

In some blockchains the metadata is stored with a third party provider such as the Interplanetary Filing System ( IPFS). In this case, the TokenURI parameter in the token contract is used to point to these data. For blockchains which can store the metadata more efficiently, such as ICP, this parameter is excluded and replaced with the metadata itself.

The Opensea marketplace has pioneered the setting of standards for NFTs [https://docs.opensea.io/docs/metadata-standards] and the following illustrations are taken from there. First, we show how the metadata should appear within the token identifiers:

The metadata is then structured in JSON as seen from this OpenSeas example:

{ 
"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": [ ... ] 
}

To give the NFTs more customisation, creators often use the attributes property to store this info, an example of this is seen below:

...
{
"attributes": [
    {
      "trait_type": "Base", 
      "value": "Starfish"
    }, 
    {
      "trait_type": "Eyes", 
      "value": "Big"
    }, 
    {
      "trait_type": "Level", 
      "value": 5
    }, 
    {
      "trait_type": "Stamina", 
      "value": 1.4
    }, 
    {
      "trait_type": "Personality", 
      "value": "Sad"
    }, 
    {
      "display_type": "boost_percentage", 
      "trait_type": "Stamina Increase", 
      "value": 10
    }, 
    {
      "display_type": "date", 
      "trait_type": "birthday", 
      "value": 1546360800
    }
  ]
}

Here trait_type is the name of the trait, value is the value of the trait, and display_type is a field indicating how you would like it to be displayed. For string traits, you don't have to worry about display_type. You can also see the use of date type which is represented using a Unix timestamp as the value.

Blockchains store metadata in various different ways. It is also important to understand how different blockchains manage these metadata, to know how it should be implemented.

Last updated