Decentralized Storage

About decentralized storage and Pinata platform

The InterPlanetary File System, also known as IPFS, is an incredibly powerful protocol that allows creators to host content too large for blockchains on a decentralized peer-to-peer network, leveraging cryptography to ensure content is unable to be changed.

The IPFS network is ideal for NFT projects that want to decentralize (transfer control from a centralized entity to a distributed network) their NFT media and make sure it does not change over time. IPFS also allows creators to take ownership of their content and how they share it.

Pinata is an NFT media management service that allows users to host, manage and share files of any kind on the blockchain of their choice. Pinata is the easiest way to pin content to IPFS and build web3 applications without having to build and manage your own IPFS nodes.

To support content addressing, we need to come up with some way to create a β€˜fingerprint’ or summary of the content that we can use to reference said content. Similar to finding a book, where we use ISBN numbers. In practice, web content addressing systems such as IPFS use cryptographic hashing functions to create fingerprints. We take the raw content (in this case, the folder with images and the folder with JSONS), and run that data through a hash function, to produce a digest. This digest is guaranteed to be cryptographically unique to the contents of the file (or folder), and that file only. If I change that file by even one bit, the hash will become something completely different.

The link to a specific file inside the folder would be hash/fileName.

​

About the resources used

Non-fungible tokens - NFTs for short - are digital assets registered on blockchain with unique identifiers and properties that distinguish them from each other. In general, it is helpful to have a name, image and attributes that represent this content. This is stored as metadata on the JSON files. Every unique identifier should point to a URI referencing its metadata.

We have two folders containing images. images-NFT contains the images that are displayed on the marketplaces and on the menu when selecting which character to play. images-in-game contains the images which have the motions of the character when moving in-game. We also have a folder for metadata called JSONS-NFT.

First, the folders containing images will be uploaded on a decentralized platform and will have attributed specific hashes. Then the JSONS will be checked to have the corresponding IPFS links to the images. Afterward, the JSONS folder will be uploaded and will have a specific hash.

There are always attributed the same hashes for the same bits so we already know the specific hashes for images and JSONS and updated them.​

Prepare resources and store them

  1. Download resources from GitHub repo https://github.com/BowTiedDeployer/workshop-nft-integration terminal command: git clone git@github.com:BowTiedDeployer/workshop-nft-integration.git

  2. Upload the folders inside jsons-and-images folder on Pinata. After uploading them, the folders should have attributed the following hashes:

    1. images-in-game - QmP1fB7x9JSMHtLmEoqEoFnnQMC1GCJ64DPCrDBxCKS23a

    2. images-NFT - QmNz74TN66hgi9X4wZ1ch9hXKxaywG5soEQPMfDqEMLVsd

    3. JSONS-NFT - QmNLo4oeN741Ai5PEafBnDtpXh2XMea8wBUGicTeErCtEB

Last updated