AllCode NFT Pinata IPFS

Uploading your NFT content to IPFS leveraging Pinata

Before you mint an NFT, you’ll want to upload the file to the InterPlanetary File System (IPFS). In general, blockchains do not store large quantities of data well. Instead of storing the content of your image or video into the blockchain, you’ll want to store the content on IPFS, and provide the hash to your content in the metadata of the NFT token.

When you add a file to IPFS, the file is split into smaller chunks, which are cryptographically hashed, and given a unique fingerprint called the Content Identifier (CID). When someone goes to access your file via IPFS, they lookup this unique fingerprint. The lookup process will access their peer IPFS nodes to see whether they have access to the CID. Once IPFS finds the CID, then the file will be downloaded for use.

The easiest way to upload your content to IPFS is to make use of Pinata. Not only does Pinata enable you to easily place a file onto your own IPFS account, Pinata also provides you with other handy features so you don’t have to become an IPFS expert, e.g. a Fast Global CDN, IPFS Gateway, etc.

After you sign up for Pinata, upload the file that you’d like to mint as an NFT. Once you’ve uploaded your file, copy the CID to your clipboard.

AllCode NFT Pinata NFT 2

When you mint your NFT token, you will store the CID into the metadata of the token like the example below. 

let metadata : {String : String} = {
          "name": "AllCode Logo",
          "street_address": "Fillmore Street", 
          "phone_number": "415-890-6431", 
          "email": "[email protected]",
          "uri": "ipfs://QmVH5T7MFVU52hTfQdWvu73iFPEF3jizuGfyVLccTmBCX2"