Sitemap

IPFS: Deep Dive

4 min readJun 20, 2022

--

IPFS stands for InterPlanetary File System and it is a distributed P2P system to access and store data, files, applications, and websites. IPFS's sole purpose is to make the internet safer, faster, and open.

History
Juan Benet first came up with the idea of IPFS, when he thought of combining the P2P file sharing structure of BitTorrent and the data-linking structure (Merkle tree) utilized by Git. He wrote the code and published the IPFS whitepaper in the year 2014. Neocities was the first site to implement IPFS since then a lot of improvements in IPFS are done.

Why IPFS was needed
Let us understand it with an example. Suppose Chris Hemsworth has uploaded a video clip of “Thor love and thunder” movie on TikTok, but you can not access it in your country as the government has blocked this app. This is the disadvantage of an HTTP server, as they are centralized. Now suppose, a lot of users have edited/tempered the clip and uploaded it on youtube. But you only want that original clip, in the HTTP server, it is difficult to find that particular original file.

Get SKORM’s stories in your inbox

Join Medium for free to get updates from this writer.

Now suppose, your friend got this original clip from a source and has also uploaded it on YouTube without any editing, but you do not believe in your friend and considered it as an edited video.

So here comes the IPFS, in which each file will have a unique hash analogous to fingerprint, and if more than one copy is uploaded on the server, then only one file will be created. And will be recognizable by its unique hash, if someone has edited/tempered it, the file will have a different hash compared to the original one. So instead of saying where to find the file, you say what file you want, This is called content base addressing. Where, you look for the file based on its unique hash.
So IPFS results in more security and no duplication so faster.

How IPFS work (How it store the files and make it accessible to world)
In IPFS files are stored in the form of IPFS objects (key-value pair) and can store up to 256kb of data. And if a file is larger than 256kb, it is split into multiple IPFS objects, and an empty IPFS object will be created in the system which will link to all the other objects.

This allows users to version their content as every data stored in the IPFS is immutable, which means once the data is uploaded in IPFS it cannot be changed, the same concept on which blockchain works. This actually follows the original concept of Juan Benet of combining Git and BitTorrent and linking back the newest version to the previous one.

Press enter or click to view image in full size

IPFS fundamental principles to look for the particular file

DHT (distributed hash table) for content discovery

Content addressing for unique hash identification

DAG (directed acyclic graphs) for data linking

DHT (distributed hash table) for content discovery
A DHT is a combination of key-value pairs utilized to look for the content the user is looking for. The libp2p project is the part of IPFS which take care of this. IPFS currently uses Bitswap to connect one peer to another in order to exchange the content the user is looking for. Once the content is arrived, it can be verified by using a CID (Content Identifier) for its originality.

Content addressing for unique hash identification
IPFS uses content-based addressing, here users look for the content based on what’s in it instead of where it is located. This trims down the lengthy process of an HTTP server to look for the original content. For this purpose, IPFS follows IPLD (Interplanetary Linked Data) to uniquely identify the content.

DAG (directed acyclic graphs) for data linking
IPFS uses Merkle DAG to look for the versioning of files and every file has a unique CID.

The all three principles work together if a user is looking for a content over the IPFS server

CID
CID is a cryptographic hash and mostly uses SHA256 to generate the hash. Mean every data has a unique hash and even a slight change in the data will entirely generate a new hash. CID uses Coded and multi hash for encoding and encoding the data.

Advantages of IPFS

IPFS encourages the decentralization

It is easy to access the original file, and can be identified by its unique hash

A file in the IPFS system can live forever until or unless all the systems are offline

It is secure, as duplicate files in the HTTP server can be insecure

It is faster as only one copy of file is created on the server, no duplicate files are allowed

Disadvantages of IPFS

If all the system which has content are offline, than user can not access the file

So a larger number of nodes (peers) are required in order to keep the availability of the content online.

Very few people know about IPFS.

If you liked this article please remember to clap and follow me for more Blockchain related content.

--

--

SKORM
SKORM

Written by SKORM

Content writer! Bounty hunter! Educator! Trader