Home » Articles » NFT Metadata Example, Standards and Format | NFT JSON Metadata

NFT Metadata Example, Standards and Format | NFT JSON Metadata

NFT Metadata Example, Standards and Format | NFT JSON Metadata

Non-fungible tokens (NFTs) are non-transferable data units on the Blockchain. Most of the time NFT can be regarded as one of the most identifying pieces of information that distinguishes them from all other tokens. Because no two tokens are alike, no users can exchange or trade them at the same rate, nor can they be divided into smaller pieces like currency.

For a more intangible purpose, the NFTs are the digital assets that users can store on the blockchain and later sell or buy new. 

An example of the NFT_metadata

An example of the NFT_metadata

Metadata NFT-Let’s Know All About NFT 

Metadata NFT

As of now, all the people know that NFT represents a single digital asset, such as an a.JPEG file,.GIF,.MP4, or anything else. Although you can host the file on the blockchain, you can not host it on the Ethereum Blockchain. So, you have to host off-chain like on an NFT marketplace. NFT metadata defines what kind of elements data includes such as the visual or auditory asset and additional information such as transactional history. 

Metadata NFT is essentially a workaround for avoiding the technical and financial disaster (or, more accurately, impossible) of keeping huge files directly on-chain on Ethereum or other blockchain platforms. The metadata approach reduced the significant challenges a user might face when storing the NFTs. In the section, you can understand it more in technical terms. 

Challenges Storing NFT on The Ethereum Blockchain 

The biggest challenge to the strength of the NFTs on the Blockchain is storage and data consumption. For instance, if you want to run a full Ethereum node, to do that you first have to download the entire Ethereum blockchain, approximately 1,050 GB in size.

Now, as you can see, it’s enough to run the entire Ethereum network—yes, all ETH-related things, NFTs, Defi, and dApps total a little steeper than 1,100 GB.

In comparison, a full-length 1080 movie is roughly 2 to 4 GB on its own, and most high-quality photos are about 2 to 20 MB. So, it seems so insane to store that amount of data on the Ethereum blockchain. 

Along with storage and data connection, it is also going to be way too expensive for any users to directly store the data 

Simply keeping 1 GB of data just on the Ethereum blockchain costs approximately 17,500 ETH. Simply storing a blockbuster film like Avengers: Infinity War just on the Ethereum blockchain may cost more than the $237 million film’s production budget.

Too much cost and heavy storage make the NFT metadata play a role. It creates a delicate balance between exploiting the blockchain and burdening it with data.

Top 30 NFT Marketplace Development Company

NFT Metadata Example

The heart of an NFT is its metadata. It is a JSON document that frequently includes the following: NFT’s acronym, description, and other important thighs. 

This NFT metadata creates the input to your NFT smart contract, which you will deploy on the Ethereum network.

So, if you want to look at the NFT metadata example, all you need to do is look at the JSON document. Here is one such example to explore-

{
  "description": "I love MakeAnAppLike.", 
  "external_url": "https://openseacreatures.io/3", 
  "image": "https://storage.googleapis.com/opensea-prod.appspot.com/puffs/3.png", 
  "name": "Dave Starbelly",
  "attributes": [ ... ], 
}

It is a JSON file to view NFT metadata that creates all the information about an NFT creation on OpenSea. There are a lot more examples to look at on OpenSea. For those who are completely new to OpenSea, it is a well-known marketplace to trade and host NFT.  

NFTs are well regulated, you can’t yield a code just randomly and tag it as NFT data. The Metadata has to follow certain standards set by its marketplace. This word keeps us on to the next topic of our discussion. Which are the NFT standards? 

Best NFT Marketing Companies WorldWide

How to Generate NFT metadata

Dump this list into a .json file using the json.dump() function.

#### Generate Metadata for all Traits 
os.mkdir(f'./metadata')

METADATA_FILE_NAME = './metadata/all-traits.json'; 
with open(METADATA_FILE_NAME, 'w') as outfile:
    json.dump(all_images, outfile, indent=4)

How to create a specific .json file for each image

  • Load in the all_traits.json
  • Specify your image “BASE URL”. Dont forget to add an additional “/” on the end!
  • Choose your project name
  • Loop over the all_traits .json dictionary using the keys accessor & output an individual .json file for each unique NFT image.
#### Generate Metadata for each Image    

f = open('./metadata/all-traits.json',) 
data = json.load(f)

# Changes this IMAGES_BASE_URL to yours 
IMAGES_BASE_URL = "https://gateway.pinata.cloud/ipfs/Qmb86L8mUphwJGzLPwXNTRiK1S4scBdj9cc2Sev3s8uLiB/"
PROJECT_NAME = "NFT_CREATOR"

def getAttribute(key, value):
    return {
        "trait_type": key,
        "value": value
    }
for i in data:
    token_id = i['tokenId']
    token = {
        "image": IMAGES_BASE_URL + str(token_id) + '.png',
        "tokenId": token_id,
        "name": PROJECT_NAME + ' ' + str(token_id),
        "attributes": []
    }
    token["attributes"].append(getAttribute("Face", i["Face"]))
    token["attributes"].append(getAttribute("Ears", i["Ears"]))
    token["attributes"].append(getAttribute("Eyes", i["Eyes"]))
    token["attributes"].append(getAttribute("Hair", i["Hair"]))
    token["attributes"].append(getAttribute("Mouth", i["Mouth"]))
    token["attributes"].append(getAttribute("Nose", i["Nose"]))

    with open('./metadata/' + str(token_id) + ".json", 'w') as outfile:
        json.dump(token, outfile, indent=4)
f.close()

NFT Standards & Schemas- What are They? 

Before moving any further, you have to know what erc721 is. ERC721 is a standard for NFT, which you have to keep in mind following an NFT standard. 

It is a token that has unique and different values. Other than that it becomes the token of the Smart Contract, either because of its age, rarity, or something else, such as its aesthetic. What, a visual?

Due to all NFTs having an uint256 variable called tokenId, the pair contract address, uint256 tokenId, stays globally unique for any ERC-721 Contract. As a result, a dapp can include a “converter” that takes the tokenId as input and generates an image of anything fantastic, such as zombies, weapons, talents, or an adorable kitten.

To create the Metadata, you will have to enter your rich metadata to the erc721 metadata standard. So, let’s get started with the tradition of the metadata; the guide will take the example of the OpenSeaNFT marketplace NFT metadata standards. 

How to Intricate The Rich Metadata to the ERC721

OpenSea can draw in rich data about digital assets and show it in-app by providing asset information and applications. Because unique identifiers only can represent the unique identifier files on a given smart contract, metadata enables these assets to have additional features such as a name, description, or image.

Executing A Token URI 

You need an executable URI to retrieve the metadata in OpenSea to enable the off-chain metadata for the essentials like ERC721 and ERC1155. 

You can use the token URI method in ERC721 and the uri method in ERC1155 to find this URI. 

The tokenURI function in ERC721 contracts and a “uri function” return an HTTP or IPFS URL. When accessed, this URL should return a JSON blob of data, including the metadata about your token. 

Metadata Structure

Metadata Structure
Metadata Structure

To create the data in the first place you need to know profoundly about the Metadata structure. A marketplace like OpenSea accepts metadata organized following the official ERC721 metadata standard or the Enjin Metadata recommendations.

It supports various more attributes that allow for media attachments – such as audio and video, and 3D models – as well as interactive qualities for your digital art, providing you full sorting and filtering possibilities on the marketplace. In the metadata, several properties work differently according to the metadata going to the web in the smart contract. 

So, if you are not developing your smart contract, you don’t have to worry about it as your developer will take care of all of this stug. However, if you are developing your smart contract and embedding metadata in it, consider going through all the attributes accurately. 

Don’t Forget to Follow The Attribute Guidelines 

Going through all the attribute guidelines can help you understand all the crucial points when developing your qualities. You should specify string attributes like strings and numeric properties as floats or integers such that OpenSea can display them correctly. But, consider your string properties must stay readable otherwise you will have problems trading the NFTs. 

Deploy Your MetaData API 

To make your NFT accessible, you have to deploy your Metadata on the API. 

The Metadata API’s primary function is to transport metadata between OpenSea during development. You can use metadata API to deploy, create, update, obtain, or delete customization data such as custom object descriptions and page layouts. 

There are various methods of moving the data, however, you have to figure out the functions, which you can use to work easily. Majorly developers use two methods for moving metadata. The first technique involves using Metadata API deploy() and retrieve() functions. Most of the developers frequently utilize the deploy() and retrieve() functions to move the entire metadata model. 

In the latter stages of development, including deploying tested customizations to production, the metadata API turns out to be the perfect tool for the developers.

If you want to put your metadataAPI into action, you are free to host your metadata API wherever you want: on IPFS, cloud storage, or your servers. You can use the API server in both Python and NodeJS to get you started.

Lastly, Freeze Your Metadata. 

Freezing your metadata securely locks and stores it on decentralized file storage, allowing other clients to view and use your data. This implies that your property will remain safely stored and you will not lose it. And you will be happy to know that OpenSea does not charge any fees to freeze your data. However, to avail the free freezing benefits, you have to follow the accurate freezing process, which goes as follows:

  • Select the object you want to freeze and click Edit.
  • Scroll to the Freeze metadata section.
  • By clicking the toggle, you can enable the feature.
  • Click Freeze once the switch is turned on.

The process, which can take a few minutes, will prompt a modal.

Once completed, validate that all of your stuff stays precisely as you want it. Because once frozen, you can’t alter or remove it because file storage stores it permanently. Then, click Submit transaction. Finally, sign your wallet and confirm the gas fee to complete the freezing procedure.

Confirm Your Metadata is Freezed

You can validate your freeze of the data in two places on OpenSea. The first time you see it is when you edit your content. The confirmation can be found under the Freeze metadata category.

The public item page becomes another area where you may validate if your metadata is frozen. Also, you may check the status of your metadata under the details section to confirm the freeze. 

What is IPFS NFT Metadata? What Does The IPFS Do? 

A decentralized protocol, IPFS serves as a file storage location that does not rely on centralized servers to host all data. Because the protocol relies on a network of nodes to function, it behaves similarly to blockchains.

Once the IPFS NFT metadata is uploaded, the data is subsequently broadcasted to other nodes via hashing technology. Because of IPFS’s decentralized nature, you will find it difficult to remove any content from the network once you submit it. As a result, it is suitable for NFT art that requires off-chain storage.

Limitation to the NFT Metadata

  • This JSON metadata normally merely identifies the object and does not provide much additional information. You can’t easily search and read the other smart contracts, which becomes a flaw and restriction of the Ethereum network that several companies are working to remedy.
  • Token miners use the metadata process generated by the NFT, which makes them owners of the NFT contract. However, other users will stay unable to update the data, for better or worse. The whole restrictions can cause problems for a variety of reasons.
  • For one thing, as the Internet ecosystem evolves, links can fail. Because the NFT metadata directs you to another location to view the art, the site will redirect you to an extremely expensive 404 error page if that link fails.
  • Users cannot update the JSON data, nor can they repair the links. The problem’s essence starts with whether the users could update the data and the inherent value of the NFT. Which in turn users have discovered as an exploit. However, updating the data allowed other main users to replace all of the metadata with images of real-world apes obtained on Google. It can cause the market to react. 

The method in the Creature contract.

{
  "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": [ ... ], 
}
The method in the Creature contract.
The method in the Creature contract.

Wrapping UP!

The basic feature that makes NFTs tick is NFT metadata. NFTs can connect to data outside of their smart contract, allowing the networks to refer to data that exists off-chain. This reduces the computational expenses of executing NFTs on a network such as Ethereum.

Metaada NFT has a unique ID that distinguishes it from every other token. The ERC-721 tokenization standard uses Ethereum smart contracts to track transfers & changes of ownership of each NFT, which is a fairly computationally intensive endeavor. As a result, gas prices for trading or minting NFTs stay often substantially greater than for merely transmitting ETH on the network. This is all about the NFT and the NFT metadata. Hope this guide has helped you with your queries regarding the metadata. To know more please refer to your preferred marketplace.

How can we get metadata cleaner like hashlips.

{
    "dna": "0101060503406",
    "name": "#549",
    "description": "MiniGuineas",
    "image": "https://ipfs.moralis.io:2053/ipfs/QmRVPPDiZwQWZbLdgxygEQLCpznahr5ADeThTnaXsC5V7t/images/0000000000000000000000000000000000000000000000000000000000000549.png",
    "edition": 549,
    "date": 1637123816441,
    "attributes": [
        {
            "name": "Green#21.8",
            "rarity": "original"
        },
        {
            "name": "Albino#4",
            "rarity": "original"
        },
        {
            "name": "Glasses#6",
            "rarity": "original"
        },
        {
            "name": "Goatee#10",
            "rarity": "original"
        },
        {
            "name": "TinfoilHat#1",
            "rarity": "original"
        },
        {
            "name": "Guitar#1",
            "rarity": "original"
        }
    ]
}
How can we get metadata cleaner like hashlips?

What do you actually want to do to the metadata? Do you just want it formatted so it is all spaced out? There are IDE plugins for your Dev Environment that do that. There is one called Prettify JSON for VS Code.

What are the Methods of Uploading NFT Metadata?

CSV Export/Import in DropKit
REST API endpoint
Copy and Paste metadata directly in NiftyKit app
Google Sheets Export

The post NFT Metadata Example, Standards and Format | NFT JSON Metadata appeared first on 2022.

Read the original article on Makeanapplike