IPFS

Sedesca Labs
Sedesca Labs
Published in
5 min readFeb 1, 2023

Source: IPFS Docs

IPFS (InterPlanetary File System) is a decentralized, peer-to-peer network for storing and sharing files. Instead of relying on a centralized server to store and serve files, IPFS distributes files across a network of nodes and tracks the location of each file using a unique hash identifier. This allows for faster and more resilient access to files, as multiple nodes can serve the same file and the network can dynamically find the quickest and most available source. IPFS also aims to address issues of censorship and control, as files can be stored and served without a central authority controlling access.

How IPFS address the HTTP problems

IPFS addresses several problems associated with the traditional HTTP (Hypertext Transfer Protocol) system:

  1. Centralization: IPFS is a decentralized network, so it does not rely on a single point of failure. This makes it more resilient to outages and censorship, as there are multiple copies of files spread across the network.
  2. Slow file transfers: IPFS allows files to be served from multiple nodes, reducing the load on any single node and making file transfers faster. Additionally, IPFS uses content-addressing to retrieve files, which allows for more efficient data retrieval.
  3. Inefficient use of bandwidth: In traditional HTTP, a file must be downloaded from the server every time it is accessed, even if it has not changed. With IPFS, files are only transferred if the file’s content has changed. This reduces the amount of bandwidth used.
  4. Broken links: In traditional HTTP, links can break if a file is moved or deleted from a server. IPFS solves this problem by using permanent, unique hash identifiers for each file, so links will always work as long as there is at least one node with a copy of the file.

Overall, IPFS aims to provide a faster, more resilient, and more efficient file storage and sharing system that does not rely on a centralized authority.

The InterPlanetary File System (IPFS) is composed of several key components:

  1. IPFS nodes: The nodes in the IPFS network store and serve files, and are connected to each other in a peer-to-peer manner.
  2. IPFS hash: Each file in IPFS is identified by a unique hash value, which is derived from the file’s content. This hash is used to locate the file on the network.
  3. IPFS protocol: The IPFS protocol defines how nodes interact with each other and how files are stored and retrieved in the network. It is based on a modified version of the BitTorrent protocol.
  4. IPFS client: A user interface that allows users to access and interact with the IPFS network. IPFS clients can be installed on a variety of devices, including desktops, laptops, and mobile devices.
  5. IPFS gateway: A gateway acts as a bridge between the IPFS network and traditional web browsers. It translates IPFS hash URLs into regular HTTP URLs, allowing users to access IPFS content using their web browser.
  6. IPNS (InterPlanetary Name System): A decentralized naming system that allows users to assign human-readable names to IPFS content. IPNS is built on top of IPFS and uses public-key cryptography to securely map names to IPFS content.

Together, these components form a decentralized, peer-to-peer network for storing and sharing files, which provides a more efficient, resilient, and censorship-resistant alternative to traditional file storage and sharing systems.

The InterPlanetary File System (IPFS) is based on several key protocols:

  1. BitSwap: BitSwap is the IPFS file sharing protocol, which is based on the BitTorrent protocol. It allows IPFS nodes to exchange files with each other, and it is responsible for efficiently distributing files across the network.
  2. DHT (Distributed Hash Table): The DHT is a decentralized index of all the files in the IPFS network. It allows IPFS nodes to efficiently find the locations of files based on their hash values.
  3. MerkleDag: MerkleDag is a data structure used in IPFS to represent file content. It is based on the Merkle tree, which is a tree data structure where each leaf node is a file and each internal node is a hash of its children. MerkleDag allows IPFS to efficiently verify the integrity of files, as well as to support versioning and linking of files.
  4. IPNS (InterPlanetary Name System): IPNS is a decentralized naming system built on top of IPFS. It allows users to assign human-readable names to IPFS content, and it uses public-key cryptography to securely map names to IPFS content.

These protocols work together to provide a decentralized, peer-to-peer file storage and sharing system that is efficient, resilient, and censorship-resistant. They form the backbone of the IPFS network and allow it to provide a distributed and decentralized alternative to traditional file storage and sharing systems.

How IPFS does work?

Here is a high-level overview of how IPFS works:

  1. File addition: To add a file to the IPFS network, a user creates a MerkleDag representation of the file and calculates the file’s unique hash identifier. This hash is used to locate the file on the network and to verify its integrity.
  2. File distribution: The IPFS network uses the BitSwap protocol to distribute files across the network. When a user adds a file, it is sent to a few nearby nodes, which can then serve the file to other nodes that request it. This helps to reduce the load on any single node and to make file transfers faster.
  3. File retrieval: To retrieve a file from the IPFS network, a user specifies the file’s hash identifier. The IPFS client then uses the DHT to find nodes that have a copy of the file and retrieves the file from the closest available node.
  4. Caching: IPFS nodes can cache frequently requested files to reduce the load on the network and to improve access speeds. This helps to make the IPFS network more efficient and resilient.
  5. Versioning: IPFS supports versioning of files by using the MerkleDag data structure. When a file is updated, a new hash is generated and the network automatically updates to the new version.

Overall, IPFS works by using a decentralized network of nodes to store and serve files, and by using unique hash values to identify and locate files. This allows IPFS to provide a more efficient, resilient, and censorship-resistant alternative to traditional file storage and sharing systems.

--

--