avatarEdward Jones

Summary

The website content provides a comprehensive guide on generating NFT metadata, a critical component of NFT smart contracts, and uploading NFT images to the cloud using IPFS through Pinata.

Abstract

The webpage is part two of a four-part series titled "NFT Creator," which focuses on generating NFT metadata and uploading NFT images to the cloud. It explains that NFT metadata is a JSON document containing essential details about the NFT, such as its name, description, image link, and traits. This metadata serves as the input for NFT smart contracts on the Ethereum network. The guide advises uploading NFT images to a cloud service like Pinata, which uses IPFS for distributed file storage, to avoid the high costs associated with storing large files directly on the blockchain. It provides step-by-step instructions on how to upload images, generate metadata, and create individual JSON files for each NFT image using a "BASE URL" obtained from Pinata. The page also previews the next steps in the series, which involve deploying NFT smart contracts and minting NFTs.

Opinions

  • The author emphasizes the importance of NFT metadata as the "core" of an NFT.
  • Uploading images directly to the blockchain is considered "very expensive" and not a best practice.
  • The use of Pinata for uploading NFT images and metadata is recommended as a cost-effective and efficient solution.
  • The guide suggests that storing NFT images on IPFS, a distributed file-sharing system, is a preferred method in the industry.
  • The author provides personal insights, such as naming their project "NFT Creator" and sharing their specific BASE URL, to illustrate the process.
  • The guide anticipates reader follow-through by outlining the next steps in the NFT creation process, indicating a sequential and educational approach.

Generate Your NFT Metadata

NFT Metadata, a crucial element in an NFT smart contract

NFT Substrapunk #93 created in this series

This is the second part of the four-part NFT Creator series:

  1. Generate NFT images
  2. Generate NFT metadata
  3. Deploy NFT smart contracts
  4. NFT minting
Part two of the four-part NFT Creator series

What is NFT Metadata?

NFT metadata is the core of an NFT. It is a JSON document that often contains the following:

  • NFT’s name
  • Description of the NFT
  • Link to the hosted image
  • Traits

This NFT metadata will be the input of your NFT smart contract which you will deploy on the Ethereum network in the third part.

Example of NFT Metadata (source: https://docs.opensea.io/docs/metadata-standards)

Upload your NFT images in the cloud

Uploading images to the blockchain is very expensive since they are large in size.

The best practice is to only upload the link of your image to the blockchain and store your image on an Interplanetary File System (more on that later).

Pinata allows you to upload NFT images for free using IPFS (InterPlanetary File System). This is a distributed file-sharing system.

Sign up for a free account and upload your NFT images folder to the pinata cloud.

I called my project “NFT Creator” but feel free to choose a different name.

Pinata allows you to upload your entire folder at once

If the upload is successful, you should be able to see your uploaded files as shown below:

Click on your project and copy the link.

This is your “BASE URL”, which you will need later on.

The BASE URL of my project is https://gateway.pinata.cloud/ipfs/Qmb86L8mUphwJGzLPwXNTRiK1S4scBdj9cc2Sev3s8uLiB

Generate NFT metadata

all-traits.json

In the first part of the NFT creator series, you have created a list called “all_images” specifying the traits for each image.

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

all-traits.json file

[token_id].json

Next, you want to create a specific .json file for each image:

  • load in the all_traits.json
  • Specify your images “BASE URL” which you copied earlier on the Pinata website. Make sure you add an additional “/” on the end!
  • Specify your project name
  • Loop over the all_traits .json dictionary using the keys accessor and output an individual .json file for each unique NFT image.

For this image, you will for example receive the following .json file:

Upload the metadata to pinata

Upload your generated metadata to Pinata in the same way as for the images.

Example NFT Metadata

Below you can find an example of the NFT_metadata file for tokenID 0 & the corresponding picture.

In the next part of the series, you will learn how to deploy an NFT smart contract.

Happy programming!

NFT Image tokenID 0
NFT Metadata of tokenID 0

Roadmap

  1. Create Your Own NFT Collection With Python
  2. Create NFT Metadata
  3. Deploy NFT smart contracts
  4. NFT minting

Resources

  1. Ethereum Developer Resources | ethereum.org
  2. GitHub — UniqueNetwork/substrapunks: Substrate based remake of CryptoPunks game
  3. GitHub — benyaminahmed/nft-image-generator
Programming
Nft
Ethereum
Python
Blockchain
Recommended from ReadMedium