Scrappy Squirrels
Published in

Scrappy Squirrels

Tutorial: NFT Metadata, IPFS, and Pinata

Pinata

Introduction

Scrappy Squirrel Artwork generated using the library
  1. Upload Images to IPFS
  2. Generate compliant JSON NFT metadata
  3. Upload metadata files to IPFS

How NFT Minting Works

Mekaverse NFTs
  1. The Token Identifier (or ID)
  2. The Owner of the Token
  3. The Metadata associated with the token
my-nft.json{   
"description": "Friendly OpenSea Creature",
"image": "https://opensea-prod.appspot.com/puffs/3.png",
"name": "Dave Starbelly",
"attributes": [
{ "trait_type": "Base", "value": "Starfish" },
{ "trait_type": "Eyes", "value": "Big" },
{ "trait_type": "Mouth","value": "Surprised" },
]
}
  1. Upload all our images online and get a URL associated with each image. (This URL will go into our metadata).
  2. Generate a separate JSON file for each image containing metadata in the standard shown above (Image URL, attributes/traits, name, etc.)
  3. Upload all the JSON files to the cloud and get a URL associated with each JSON file.

Uploading Images to IPFS

  1. Centralized Storage tends to be location based
    Imagine you upload an image of a dog (called dog.jpeg) to a centralized storage service. Your dog image would then be available by accessing a URL (something like https://mystorage.com/dog.jpeg).
    However, it is very easy to swap this image for another. I could upload another image with the same name (dog.jpeg) that replaces the original image.
    Now, if I visited the same URL as before (https://mystorage.com/dog.jpeg), I will see a different image. You can see why this is not ideal in NFT world. People spend thousands of dollars on NFTs and they would be pissed if you simply replaced an avatar with extremely rare traits with something else.
  2. Centralized Storage can be taken down
    Let’s say you upload an image to a Google Drive or AWS. If you removed the image from these services or the services themselves shut down, the URL pointing to the image would break. Therefore, it is very easy to pull the rug if your images and data exist on a centralized storage service.
  1. IPFS used content-based addressing
    On the IPFS network, the address (URL) of a file will be dependent on the content of the file. If you change the contents of a file, then the address of the file on the IPFS will also change.
    Therefore, on the IPFS network, it is impossible to make one URL point to two different images.
  2. IPFS never goes down
    Like most decentralized systems (like blockchains), IPFS never goes down. This means that once you’ve uploaded a file (or image) to IPFS, it will always be available as long as at least one node in the network has the file. This means that you cannot pull the rug at will. Nor is there a threat that the system will be shut down.
  1. https://hackernoon.com/a-beginners-guide-to-ipfs-20673fedd3f
  2. https://docs.ipfs.io/how-to/mint-nfts-with-ipfs/#a-short-introduction-to-nfts
Pinata Upload Screen

Generate compliant NFT JSON metadata

Opensea is the world’s largest NFT marketplace
Sample inputs
python metadata.py

Upload JSON metadata files to IPFS

Conclusion

--

--

Scrappy Squirrels is a collection of 10,000+ NFTs on the Ethereum blockchain. This publication was created as part of the roadmap to increase awareness, and provide resources to people new to the blockchain space.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store