As we are getting into NFT time zone, many times we have heard the word IPFS (Inter Planetary Filesystem).
It may be good to understand the basic concept of IPFS and how to apply to recent blockchain and NFT utilization.
IPFS, or inter planetary filesystem, is a distributed P2P protocol that allows files of any type to be saved across a network of nodes.
The content is accessible through peers located anywhere in the world, which can transmit information and/or store it.
HTTPS is a centralized protocol that store and transmit all data via central data storage and management.
It integrates with other blockchains, such as that of Ethereum, as it allows for the storage of data and metadata in a secure, off-chain manner. In the NFT world it is used constantly for storing images, videos and music. By using only a reference to the file (url) within the SmartContract this saves storage space and costs.
Simply put, the internet is a collection of protocols that describe how data moves around a network. Developers adopted these protocols over time and built their applications on top of this infrastructure. One of the protocols that serves as the backbone of the web is HTTP or HyperText Transfer Protocol. This was invented by Tim Berners-Lee in 1991.
Problems with HTTP
Let’s say you are sitting in a lecture hall, and the professor asks you to go to a specific website. Every student in the lecture makes a request to that website and are given a response. This means that the same exact data was sent individually to each student in the room. If there are 100 students, then that’s 100 requests and 100 responses. This is obviously not the most efficient way to do things. Ideally, the students will be able to leverage their physical proximity to more efficiently retrieve the information they need.
HTTP also presents a big problem if there is some problem in the networks line of communication and the client is unable to connect with the server. This can happen if an ISP has an outage, a country is blocking some content, or if the content was simply deleted or moved. These types of broken links exist everywhere on the HTTP web.
How does IPFS work?
IPFS seeks to create a permanent and distributed web. It does this by using a content-addressed system instead of HTTP’s location-based system.
An HTTP request would look like http://10.20.30.40/folder/file.txt
An IPFS request would look like /ipfs/QmT5NvUtoM5n/folder/file.txt
Instead of using an location address, IPFS uses a representation of the content itself to address the content. This is done using a cryptographic hash on a file and that is used as the address. The hash represents a root object and other objects can be found in its path. Instead of talking to a server, you gain access to this “starting point” of data. This way the system leverages physical proximity. If someone very close to me has what I want, I’ll get it directly from them instead of connecting to a central server. In the lecture example from earlier, the students in the classroom can pull the data from each other without all having to establish their own communication with the a server. With HTTP you are asking what is at a certain location whereas with IPFS you are asking where a certain file is. In order to accomplish this, IPFS synthesizes a few successful ideas from other peer-to-peer systems.
Distributed Hash Table
To store data, IPFS uses a Distributed Hash Table, or DHT. Once we have a hash, we ask the peer network who has the content located at that hash and we download the content directly from the node that has the data I want. Data is transferred between the nodes in the network using mechanisms similar to BitTorrent. A user looking for some content on the IPFS web finds neighbors who have access to that content. They then download small bits of the content from those neighbors. On top of the DHT and the BitTorrent protocols, IPFS uses a Merkle Tree. This is a data structure similar to the one Git uses as a version control system and the protocol used in the bitcoin blockchain. In Git, its used to track versions of source code, whereas in IPFS it’s used to track content across the entire web.
Source: Coinmonks, Wolverine Blockchain