As you now know if you watched the video above, the internet most of us think of uses location addressing. URL stands for Uniform Resource Locator (emphasis added by me). A URL tells a browser which folder on which server to go to find the content to display. For example, let’s take the following URL:
https://www.savaslabs.com/sites/default/files/2021-09/Infographic.png
This URL tells the browser to display the image named Infographic.png that can be found in the sites/default/files/2021-09 folder on the server hosting the Savas Labs website.
If someone went into that folder and replaced Infographic.png with a completely different image, but with the same name, the new image would display. The original content isn’t inherently tied to the address.
This poses a problem for NFTs, where being able to verify the authenticity of the file is crucial. For this reason, best practices state that NFT assets should be hosted on IPFS (InterPlanetary File System), a system leveraging content addressing - that is an address that is tied to the content of the file.
Enter Pinata, a service that bills itself as making managing NFT media and utilizing content addressing easier. I think of Pinata as cloud storage for generating and managing IPFS files, with a nice API on top.
For a recent project, we were building an NFT WordPress plugin called Minterpress that would allow artists to mint and display NFTs on a public-facing WordPress site. But pinning media with Pinata requires the usage of Pinata’s Node SDK and WordPress is written in PHP, not Node. In order to use Pinata to manage the NFTs we create in our WordPress plugin, we needed to pass all of the information we collect about the NFT (the metadata) to be created through a Node app to Pinata.
So, I built a microservice to act as a Pinata proxy: https://github.com/savaslabs/minterpress-pinata-proxy
Based very heavily on @claudebarde’s backend approach in How to mint NFTs on Tezos using Taquito and Pinata, the proxy provides a single endpoint for pinning media and metadata from any client-side application to Pinata, where a cryptographic hash is created and pinned to IPFS. This is a one-way encryption system. There is no way to reverse-engineer a file from an IPFS hash. This guarantees that the URL where the (soon to be minted) NFT is located will always store the pinned content. The file can’t be replaced by another file, because that file would have a different IPFS hash and therefore not exist at the minted URL.