IPFS stands for the InterPlanetary File System (believe it or not). In their own words it is:
A peer-to-peer hypermedia protocol
designed to preserve and grow humanity’s knowledge
by making the web upgradeable, resilient, and more open.
So what does it have to do with NFTs?
IPFS enables creators to deploy their NFTs and to store their files off-chain and put immutable, permanent links in transactions — securing content without having to put the data itself on-chain. IPFS empowers creators to build and share on the decentralized web — providing each NFT with a cryptographic hash known as a content identifier. This has cannot be tampered with or censored without destroying every single decentralized copy.
Can someone give me an ELI5?
Let’s provide an example: when you create an NFT, a smart contract manages the ownership record for that NFT’s tokens. The hash of those NFT transfers are stored on the Stacks blockchain, and every Stacks block results in a hash stored directly on the BTC blockchain in a BTC transaction. Similarly, IPFS stores a hash of the unique files that exist in a given directory, and this hash can be used to represent (and access) these files.
More specifically, when a file is saved to IPFS, an exact hash of that file is generated and that file can be accessed by anyone in the world, as long as that file is hosted by at least one node—and anyone can host their own node. Given that anyone with an IPFS node can store that exact file that will always result in the same hash, in practice, this means that anyone with a vested interest in that file’s existence can store a copy for the benefit of everyone else who would ever want to access that file.
So, to tie this back to an NFT smart contract, when you create an NFT, the immutable IPFS hash is stored directly in the smart contract source code, and the immutable smart contract is ultimately resolved onto the BTC blockchain. Therefore, if you wanted to censor or modify the hash at which your NFT metadata lives, you’d, in effect, need to reorganize the entire Bitcoin blockchain, something that would cost hundreds of millions of dollars to do. In short, using IPFS and NFT smart contracts ensure your NFTs will live on so long as someone has an interest in them existing.
Why not store the images on the Bitcoin blockchain itself?
While the method we described above may seem like additional layers of abstraction, that is somewhat the point. Satoshi Nakamoto even spoke about the idea of additional layers being built above the base money layer, and this is for good reason.
The money layer is the most scarce and expensive blockspace, where you should ideally only settle the most critical information. If you tried to store a high resolution image on the BTC blockchain directly, it would cost hundred of thousands, if not millions of dollars to do so. So, by using layers of abstraction (such as the Stacks blockchain) that still rely on Bitcoin’s finality and immutability, you get the security benefits, with the scalability and practicality that additional layers provide. Likewise, by using a decentralized file storage system, designed specifically for storing large amounts of data, you can achieve sufficient levels of decentralization without the impractical financial barrier to entry.
There is one important detail that makes NFT metadata just as immutable as any other blockchain data, which is including a function in the smart contract that freezes the metadata, what this means is you are not able to change the hash that exists within the contract, and with this final piece, the NFT metadata is permanently bound to the NFT contract. Before freezing the metadata, the IPFS root can be updated by the contract deployer. This is helpful to ensure no errors or missing data has been included in the initial IPFS root, but it’s always a best practice to freeze metadata as soon as it’s clear that the metadata is final.
How does this apply to me the creator/collector?
Gamma includes a freeze metadata function in all contracts, and encourages creators to take this irreversible action, as soon as they are sure there are no mistakes in their metadata. Any user or collector can see whether the metadata has been frozen or not based on the blockchain record, all secured by Bitcoin.
Gamma’s launchpad includes free storage and pinning of files. Creators or community members who’d like to reduce counterparty risk of solely relying on Gamma may store and pin their own copies to IPFS. The beauty of IPFS is that anyone can download, serve and replicate off-chain NFT data in as many places as they’d like using whatever tools they prefer. Long live IPFS!
The post What is IPFS and How Does it Work? appeared first on Gamma.io Blog .