[Advanced Small Classroom] IPFS's relationship genealogy, technical architecture and working principle

[Advanced Small Classroom] IPFS's relationship genealogy, technical architecture and working principle
In the previous [Advanced Small Class], we analyzed the many drawbacks of the Internet currently built by the HTTP protocol, and introduced the basic concepts of IPFS and how IPFS builds the next generation of the Internet. Click the picture below to view it. Today, I will share with you the relationship genealogy and technical architecture of IPFS.

 

IPFS relationship map
  
IPFS was initiated by Juan Benet in May 2014. In 2015, the project "IPFS" he created won the Y Combinator startup incubation competition and received angel investment, and he also established the Protocol Lab.

 
IPFS is essentially a content-addressable, versioned, peer-to-peer hypermedia distributed storage and transmission protocol. Its goal is to supplement or even replace the Hypertext Media Transfer Protocol (HTTP) used in the past 20 years , hoping to build a faster, safer, and freer Internet era.
 
 
When developing IPFS, the Protocol Labs team adopted a highly modular integrated approach, developing the entire project like building blocks. Among them, IPLD, LibP2P, and Multiformats serve the bottom layer of IPFS. Filecoin is the incentive layer of IPFS, which makes the data of IPFS applications valuable.
 
Mutiformats is a collection of hash encryption algorithms and self-description methods . It has 6 mainstream encryption methods such as SHA1\SHA256\SHA512\Blake3B, which are used to encrypt and describe the generation of nodeID and fingerprint data. It performs self-description transformation on the value based on the existing protocol, that is, you can know how it is generated from the value.
 
libP2P is the core of IPFS . Facing a variety of transport layer protocols and complex network devices, it can help developers quickly build a usable P2P network layer, which is fast and cost-effective. The main functions of libp2p include: discovering nodes, connecting nodes, discovering data, and transmitting data. It is similar to a courier company in the real world, connecting to thousands of nodes. In addition to distributing data, it is also responsible for finding data.
 
 
IPLD is a conversion middleware that unifies existing heterogeneous data structures into one format to facilitate data exchange and interoperability between different systems. IPLD now supports block data from mainstream public chains such as BTC, ETH, and EOS. IPLD middleware can unify different block structures into one standard for transmission, providing developers with a relatively high standard for success without having to worry about performance, stability, and bugs. This is also an important reason why IPFS is popular with many blockchain projects.
 
IPFS applies the functions of these modules and integrates them into a containerized application, which runs on independent nodes and is accessible to everyone in the form of a web service.


Since IPFS is an open source protocol, everyone can use IPFS for free to carry out various developments. At present, the number of nodes in the IPFS network is not large enough, and the network is not stable enough. In order to quickly popularize IPFS, Protocol Labs created the Filecoin blockchain project based on the IPFS network to incentivize miners who participate in IPFS nodes and store data. Filecoin makes the data of these applications valuable, and through incentive policies and economic models similar to Bitcoin, it allows more people to create nodes and use IPFS.

Filecoin is the economic incentive system of IPFS, which carries the value transfer of IPFS and maintains the development of the IPFS ecosystem.
  
 
Technical architecture of IPFS
  
IPFS has eight sub-protocol stacks, from low to high, namely identity, network, routing, exchange, object, file, naming, and application. Each protocol stack has its own functions and complements each other.  

 
Identity and Routing Layers
 
The identity and routing layers can be explained together. The generation of peer node identity information and routing rules are generated and formulated through the Kademlia protocol. The KAD protocol essentially builds a distributed loose hash table (DHT). Everyone who joins the DHT network must generate their own identity information, and then use this identity information to store the resource information in the network and the contact information of other members.
 
Just like sharing WeChat business cards, if you want to find someone and cannot directly search for the WeChat ID, you can establish contact by sharing a business card with a friend who has that person’s contact information.
 
Network Layer
  
The network layer is the core layer of IPFS technology, and the lib2p used can support any transport layer protocol. The ICE NAT traversal framework integrates STUN, TURN and other types of NAT protocols. This framework allows clients to use various NAT methods to open up the network and complete NAT communication, which is very important for IPFS's p2p network.  
 
Exchange Layer
  
The exchange layer is similar to BT tools such as Xunlei and eMule. The IPFS team innovated BitTorrent and called it Bitswap. It added a credit and billing system to incentivize nodes to share. Users can increase their credit value by sending data to other nodes, and decrease their credit value by receiving data from other nodes. If users only receive data but do not share it, their credit score will become lower and lower and be ignored by other nodes.
  
Object layer and file layer

The object layer and the file layer can also be discussed together. Together, they manage 80% of the data structures on IPFS. Most data objects exist in the structure of Merkle DAG, which facilitates content addressing and data deduplication. The file layer is a new data structure that is parallel to DAG and uses the same data structure as Git to support version snapshots.
 
Naming Layers
 
It has the feature of self-verification (when other users obtain the object, the fingerprint public key is used for signature verification, that is, to verify whether the public key used matches the NodeId, which verifies the authenticity of the object published by the user and also obtains the mutable state), and adds the ingenious design of IPNS to make the encrypted DAG object name definable and enhance readability.
 
Application Layer
  
The core value of IPFS lies in the applications running on it, which can utilize its CDN-like functions to obtain the desired data at a very low bandwidth cost, thereby improving the efficiency of the entire application.
 
 
How does IPFS work?
 
IPFS addresses files based on their contents . IPFS assigns a unique hash value (file fingerprint: created based on the contents of the file) to each file . Even if the contents of two files differ by only 1 bit, their hash values ​​are different. Therefore, IPFS addresses files based on their contents, unlike the traditional HTTP protocol which addresses files based on domain names.
IPFS establishes file version management for files . IPFS removes duplicate files across the entire network and establishes version management for files, that is, the change history of each file will be recorded, and you can easily go back to the historical version of the file to view the data.
 

File query based on hash value . When querying files, the IPFS network searches based on the hash value of the file (unique in the entire network) . Since the hash value of each file is unique in the entire network, the query will be easy to perform. In addition to storing the data it needs, each node also stores a hash table to record the location of the file storage, which is used to query and download the file.  
 
IPNS . ​​IPNS allows users to use a private key to attach a reference to the IPFS hash, using a public key hash to indicate that your website is the latest version. If you have used Bitcoin, you may be familiar with this. A Bitcoin address is also a public key. If the link does not work, don't worry. You can change the content pointed to by the public key, and the public key will always remain unchanged. In this way, the problem of updating the website is solved. Next, you only need to ensure that the location of these websites is human-readable, and all problems will be solved.
 

Human-readable mutable addresses . IPFS/IPNS hashes are large, ugly strings that are not easy to remember. So IPFS allows users to use the existing Domain Name System (DNS) to provide human-readable links to IPFS/IPNS content. It allows users to do this by inserting the hash into a TXT record on a domain name server.
 
IPFS HTTP Gateway , a bridge between the old and new networks. Through an HTTP gateway, IPFS can achieve the transition from HTTP to IPFS, and now allows current web browsers to access IPFS before browsers fully support IPFS. Users will soon be able to switch to IPFS to complete the storage, distribution, and service of the Web network.
 
The IPFS protocol is open source and supports any team or individual to store and download data for free. How can IPFS be quickly popularized and developed so that more node participants are willing to use their computer hard drives to store other people's data? This requires the incentive layer of IPFS - Filecoin.
 
In the next issue of [Advanced Mini Class], we will begin to explain in detail what Filecoin is, the relationship between Filecoin and IPFS, etc. Please stay tuned.

For more information about IPFS and Filecoin, and for friends who want to participate in Filecoin mining, you can add Kuangge on WeChat ( WeChat ID: kuangge2018 ).  


<<:  Why distributed file storage is essential for a better internet

>>:  IPFS White Paper: Interplanetary File System for Building Web3.0!

Recommend

A woman with a rich life

I believe that a rich and worry-free life is what...

How many marriages will you go through?

Do girls worry about marrying the wrong person? T...

The facial features of a materialistic woman

The facial features of a materialistic woman Alth...

Old money seeks new things: Wall Street accelerates "on-chain"

From Bitcoin spot ETF to the tokenization wave, i...

What does it mean to be a husband-killer?

The husband-killing face is a type of physiognomy...

Is it good for people with different sized eyes to have bad luck in love?

In real life, different people have different fac...

What does it mean when the root of the mountain is connected to the forehead?

There are many meanings in facial features, and s...

CZ took over FTX but set off the real Lehman Brothers in the crypto world

At 0:00 am on November 9, SBF posted a tweet on h...

How to read girls' palm lines? Straight and smooth relationship

There are some differences in the views on girls&...

The shape of your nails can tell your fortune and love luck

Manicure is very popular nowadays. The beauty of ...

Judging from your appearance, what kind of lover you are looking for

Everyone is different, and different personalitie...

The brightest star in the night sky - Jinbei HS3-SE disassembly review

2020 was a relatively lonely year in the blockcha...