A Brief Introduction to IPFS
What is InterPlanetary File System (IPFS)?
The InterPlanetary File System (IPFS) is a protocol and peer-to-peer network for storing and sharing data in a distributed file system.
With this fancy name, IPFS has an ambitious goal to make the web becomes completely distributed on a peer-to-peer network. To understand what IPFS is, we have to know how we usually access the content on the web now.
Let’s say we want to visit the Wikipedia page to learn more about aardvarks, usually we visit
https://en.wikipedia.org/wiki/Aardvark. It is exactly telling the computer where to find the webpage, which called location-based addressing.
Instead of identifying a file by where it is located, IPFS identifies a file by what the content is. For example, to get the same aardvarks from the mirror of Wikipedia hosted on IPFS, we can access with this
We can view the link above by opening it through an IPFS Gateway. Just add
https://ipfs.io to the start of the link and we are able to view the page. If you are using Brave browser, you can simply replace
ipfs:// to visit the page as Brave has native IPFS support.
The hash code after
/ipfs/ is the content identifier and it is the cryptographic hash of the content. The hash code is unique to the content, which brings the advantage of deduplication because if someone tries to upload the same content, the generated hash code will be the same and it won’t be duplicated. If we want to update the content with a new version, the hash code will be different as the content has changed.
Content Versioning on IPFS
Do I have to give someone a new link every time I update the content?
This is where InterPlanetary Name System (IPNS) and DNSLink come in handy.
To explain IPNS and DNSLink in a simple way:
IPNS solves the versioning issue by creating an address that can be updated.
DNSLink is a faster solution than IPNS and uses human-readable names.
We won’t dive deep to this topic since this article is supposed to be a brief introduction. Feel free to learn more by clicking the links above.
Why does someone name IPFS as the hard drive for blockchain?
IPFS is not a blockchain, but its structure shares some similarities with blockchain. The data stored on both IPFS and blockchain are immutable, distributed, censorship resistant.
As storing large amounts of data in blockchain is expensive, IPFS enables us to store the files off-chain and put the generated permanent link in the transaction.
One of the use cases is storing the content of NFT on IPFS. If we simply store the content of NFT using traditional HTTP links, whoever has the write access to the server can easily replace the content with something else. The immutability of the content-based addressing IPFS can tackle the problem.
About IPFS Gateway
We mentioned about IPFS Gateway earlier, but what it is.
IPFS is a protocol that is not yet supported by all modern browsers natively. IPFS Gateway provides an HTTP-based service as a workaround to allow IPFS-ignorant browsers to access IPFS content. Brave is the first browser that added native support for the IPFS protocol.
Thanks for reading!