How to host your NFTs on IPFS using Pinata

0 2441
Avatar for CryptoSorted
3 years ago

The InterPlanetary File System (IPFS) is a distributed and decentralised file system. It's quite unique in its design and could be best described as if the World Wide Web met BitTorrent and used Git.

In short, it's a way for people around the world to host files and folders that are uncensorable and decentralised.

As a result of this one of the main uses of IPFS is to host the image, music, video, or attached file of a non-fungible token (NFT) with artworks such as Beeple’s “Everydays: The First 5000 Days” (pictured below) being hosted on the network.

In today's guide, I’ll be running you through how to get started hosting files, in this case, an image, for your NFTs on IPFS using Pinata.

There are many providers that you could use but I use Pinata due to its simplicity and competitive pricing.


Getting Started

Firstly you’ll need to create an account with Pinata. All that is required is an email address and it should only take a minute.

When you sign up, Pinata will host 1 gigabyte of your files, for free, forever.

If you use up your 1GB and require more you can pay them for more space at a rate of $0.15 per gigabyte every month which is relatively cheap.

Sadly you can’t pay this with cryptocurrency at the moment but they have said that they will look into it.

To host your first file you need to upload it and then “pin” it. Pinata merges these two actions into one but it's important to know the difference.

Uploading a file is when you put the file onto the IPFS network for the first time for all to see.

A CID for the file is then generated. This is the unique identifier for it and starts with “Qm” or “Bafy”.

People will need the CID to access your file and it is the CID that is typically linked in NFTs.

Pinning a file, on the other hand, is just a way of telling the node (in this case Pinata) to keep a full download of the file and to exempt it from being picked up by the garbage collector. 

To upload your image to Pinata simply go to the Pin Manager tab (shown below) and click the blue upload button. Then select the file.

And that's all there is to it.

If you scroll down you will see your file and Pinata will give you the CID. For instance, I just uploaded my phone wallpaper which has the CID “QmdnDF1bAR8xvsp5TxxZDxKBW1YK9HPCrnM226roUGbwGM”.

If you ever wish to host the image yourself or through a different provider, you can enter this CID and pin the file whilst the file is still hosted on Pinata.

Then you can take down the file from Pinata and it will still be accessible via the same CID as long as the new provider is online and has it pinned.

Viewing the file

Now that our file is hosted on the network, we want to be able to view it.

There are numerous ways of doing this. If you use Brave browser (as many crypto enthusiasts do) you can reference the protocol directly.

You can view the image I just hosted at “ipfs://QmdnDF1bAR8xvsp5TxxZDxKBW1YK9HPCrnM226roUGbwGM”.

This also works with the Puma browser.

However, if you're on any other browser you can use a gateway. These are websites that connect you to the network so that anyone can access the file.

The downside is that these weblinks could stop working in the future and so if you use them in an NFT, the image may fail to appear, even if it's hosted on the network.

The main gateways are https://ipfs.io and https://gateway.pinata.cloud.

You can view my image at https://ipfs.io/ipfs/QmdnDF1bAR8xvsp5TxxZDxKBW1YK9HPCrnM226roUGbwGM and https://gateway.pinata.cloud/ipfs/QmdnDF1bAR8xvsp5TxxZDxKBW1YK9HPCrnM226roUGbwGM respectively.

When it comes to how you should link it in your NFT the most popular method at the moment is to use a gateway, although it may no longer work in the future.

Upload AFTER The NFT Is Minted!!!

One more, feature of Pinata is that it has a CID verifier. This allows you to upload your file and generate the CID hash (Qm… or Bafy...) without uploading it to the public network.

This is useful as it allows you to create your NFT and include the link, without the file being publicly viewable, preventing content theft (as any copies made will have a mint date after your own).

Once your NFT has been purchased you can then upload the image and it will have the CID that you previously generated and so the link will then start to work.

When advertising the NFT you can use a lower resolution image or a clip of audio (off-chain) and then only make the full file viewable later on, so the buyer knows what they are getting and has the peace of mind that they are buying the art from its creator and not a copy.

Conclusion

IPFS is still a new technology and lacks much adoption in the real world.

Despite this, it's one of the best solutions for decentralised file hosting and seems to form a perfect match with NFTs.

Hopefully, you’ll now be able to host your NFTs or any file for that matter using Pinata and integrate IPFS into your projects.


What are your experiences with hosting your NFTs? Have you come across any NFTs utilising IPFS? (You may own a few and not even know). Share your thoughts with us in the comments section below.


9
$ 5.45
$ 5.45 from @TheRandomRewarder
Sponsors of CryptoSorted
empty
empty
empty
Avatar for CryptoSorted
3 years ago

Comments