It is a protocol and peer-to-peer network that allows the storage and sharing of data in a distributed file system. IPFS is a project with great potential that could change how the Internet works. A comparison of IPFS and HTTP will help you understand its basics, but to see how it compares to the Web, we have to understand its final goal.
A project called IPFS by Protocol Labs was founded in 2015 in order to create a system that could revolutionize the way information is transmitted across the globe and lead to a more resilient, distributed web. In addition to disintermediating the music industry, IPFS is easing weather risk mitigation for agribusiness and improving information management for a wide range of industries. Among the projects Protocol Labs works on are IPFS, the modular protocols needed to support it, and Filecoin, among others. Together, they serve thousands of organizations and millions of people. The IPFS network is a distributed system that stores and provides access to data, websites, applications, and files. As IPFS (Internet File System) has rules that govern how data and content move across networks, IPFS is transport layer agnostic and can communicate using various transport protocols, including Transmission Control Protocol (TCP), uTP, UDT, QUIC, TOR, and even Bluetooth. This is similar to Kademlia, the DHT that is widely used in BitTorrent and widely known as the peer-to-peer distributed hash table. An entirely client-side browser can completely run distributed websites with this file system layer.
World Wide Web applications are primarily built around HTTP and HTTPS protocols. These application protocols serve as a means of enabling data transmission and accessibility throughout the world. For example, if Emma visits a website, her web browser will send the content (e.g., content from Amazon Web Services) to the hosting server. HTTP works as a request-response protocol that connects clients (users) with servers, based on their location. Her web pages will be returned if all goes smoothly to her via the AWS server.
AWS hosts a large number of websites, but their content is not permanent because it is maintained by a centralized server. Additionally, a large portion of the Internet can be rendered unavailable if their server goes down for any reason.
The IPFS protocol, in contrast, allows for the creation of a permanent and distributed Web, in which any kind of digital content can be stored and shared. Whereas HTTP communications depend upon a server (with a specific location), IPFS communications incorporate the content itself.
IPFS allows Emma to ask the distributed network “who can provide me with this content?” instead of directly using the AWS server. Through IPFS, she will get a quick response from the closest peers.
IPFS may offer many advantages over HTTP, such as censorship resistance, data integrity, lower operational costs, better performance, and security, depending on its implementation.
Low incentives result in a small number of peers in the network, which is one limitation. Files can become inaccessible if only a few nodes are available and all of them go offline. Limited adoption makes it harder for files to be permanently available.
How its Work
- A cryptographic hash is a fingerprint that uniquely identifies a file and all the blocks within it.
- The IPFS protocol eliminates duplication across the p2p network.
- In a network, each node stores information that is relevant to itself, plus some indexing information to help determine what is stored where.
- The network must find the nodes storing the contents behind the hash of a file in order to display or download it.
- Thankfully, you won’t have to remember the hash — IPNS is a decentralized system that lets you search for files by their human-readable names.
The IPFS Object model
An IPFS object is a data structure with two fields: the name and the location of the object. IPFS is a peer-to-peer system for retrieving and exchanging IPFS objects.
- This is unstructured binary data of 256 kB size grouped into a blob.
- There is an array of Links, which serve as links to other IPFS objects.
There are three data fields in a Link structure:
- Name: The Link’s name.
- Hash: An IPFS linked object’s hash.
- Size: Link size, including following its links, is the cumulative size of the linked IPFS object.
IPFS can be used to store these results in a distributed database. Blockchains are naturally structured in a DAG, as the hashing of old blocks is always linked to those of the present. Blockchains with more sophistication, like the Ethereum blockchain, have an associated state database that is modeled on the Merkle-Patricia tree structure and can also be emulated with IPFS objects.
The following data would appear in each block of a blockchain if it were simplified:
- A list of transaction objects
- A link to the previous block
- The hash of a state tree/database