The internet is an amazing invention that has become intertwined in billions of people’s everyday lives. Everything between banking, learning, watching movies, and connecting people are done using the internet. It’s impossible to deny how the internet has become one of the most important inventions for society, but yet, it isn’t entirely perfect. Specifically, one of the problems with the current state of the internet is that it is centralized. This means that all the information on the internet is available through large server farms that hold this data. Centralization, in turn, brings troubles such as censorship, and servers that can go offline. To eschew the notion of a centralized web, another solution was created. Specifically, one solution looking to move beyond the centralized web is that of the InterPlanetary File System, or IPFS.
More accurately, the InterPlanetary File System (IPFS) wants to make the internet decentralized. Anyone familiar with blockchain technology will know that decentralization is a hot topic, and one that is not only relevant for how files are stored on the internet. Blockchain has sparked the opportunity for decentralized networks of assets like cryptocurrencies, and enable decentralized finance (DeFi), two sectors that are growing at a rapid rate.
Nevertheless, before we dive into IPFS, we should first make sure we have a good understanding of how today’s internet works. This will provide us with the necessary information to help us see the benefits of a decentralized solution like the InterPlanetary File System (IPFS) and how it’s different from previous technologies.
The Internet and Its Pros and Cons
Accessing content on the internet today is an easy task. In a broad sense, we tell our computers where the content is located, then the computer receives the demanded content. This is called “location-based addressing.” What we supply to our computers is the location of the desired file, which, in this case, is either a domain or an IP address.
One reason that we use this system is efficiency. We have a high demand for internet speed, and this system works great for this purpose. Since the information is stored in massive servers, the entity controlling these servers can control the rate at which content is delivered.
However, as we mention in the opening paragraph, the internet is a centralized solution where all the information is stored using huge server farms. This means that the current system comes with a few drawbacks. Two of the main problems with having a centralized internet are censorship and a single point of failure.
One example of censorship becoming a problem was shown in Turkey in 2017. Almost four years ago, Turkey decided to ban Wikipedia due to “terror-related content”, albeit the legitimate reason for the ban can be discussed. Nonetheless, this shows how the centralization of data on the internet can result in censorship. This means that other countries can do the same, and this can become very dangerous.
Furthermore, the current system provides a single point of failure. Since vast amounts of information are stored in one location, and if that location goes offline, the data can not be accessed anymore. However, even though the current system has flaws, we are still using it – so why? The answer to this is that there has not been a great alternative, but this might be about to change.
What is the InterPlanetary File System (IPFS)?
The development of the InterPlanetary File System, or IPFS, began in 2015 by a small team of developers, and the company behind this innovation is Protocol Labs. Juan Benet, the CEO of Protocol Labs, initially designed IPFS to create a P2P-based, decentralized solution for the internet.
Juan Benet
This is precisely what IPFS is, a decentralized protocol used for storing information, accessing information, websites, applications, and other data. There are many applications for the IPFS, and it can be used to eliminate some of the problems with the current internet that we brought up in the previous section. But how is this all possible?
Content-Based Addressing
A critical part of the InterPlanetary File System is what is known as “content-based addressing.” As mentioned above, the internet is based on “location-based addressing,” which means that files are located based on their location. IPFS aims to implement content-based addressing instead.
Content-based addressing means that files would be allocated through the content itself. Instead of telling a computer where the file’s location is, the computer’s instruction is simply what you want. This might sound somewhat abstract, and how can the computer know what it is you want to locate?
In this system, each file has a unique hash. A hash can be described as an identification for a specific file. When downloading a file, the computer asks the IPFS if someone has the file with the particular hash and simply downloads this file from another node in the network. However, this might cause some concerns that it is actually the right file being sent to us and not a file that has been tampered with. But the hash solves this problem, too, since if the file has been tampered with, then the hash will change with it.
Along with identifying files, a hash is helpful for other purposes as well— one in which is avoiding having multiple duplicates of the same file. If multiple people were to publish the same file on the IPFS, then the file will only be created one time. This, in turn, will help the network be more efficient and faster.
To find which node/nodes that are hosting a file, the system uses what is known as a Distributed Hash Table (DHT). The table tells the users of the network which node has what data. This means that the DHT is used when trying to locate a file through the content-based addressing system.
How does IPFS Store Files?
The concept of content-based addressing is excellent, but the description above leaves a lot of unanswered questions – one of which is “how does IPFS store files?”
Objects
All files in the IPFS system are stored as so-called IPFS objects. Each object has a space limit where it can only store up to 256 KBs of data. In addition to the 256 KBs of data, each object can store links that refer to other IPFS objects. However, as you might have noticed, the space is very limited when it comes to a single object. At an initial look, this would seem like the system will have problems storing larger files than the limit. But this is not the case since the IPFS has a solution for this.
If we have a file that is greater than 256 KBs worth of data, an example here can be an image. To enable the file to be stored in the system, the InterPlanetary File System splits the file and divides it into several different objects that do not exceed the 256 KB limit. Once the file is split, the system creates one more empty object that links to all objects containing the image’s data. This system is very simple, but it can be very powerful if it is utilized in the right way.
Along with this decentralized storage system, the IPFS shares one crucial characteristic of a blockchain. This trait is that once something is stored in the system, it can not be changed. This is great for security reasons, but what happens if someone would like to change a file in the system?
Versioning & Commits
More specifically, the InterPlanetary File System (IPFS) supports something called versioning. This means that if someone wants to share a file that they are working on, the IPFS creates a new commit object. This commit object simply refers to the commit that came prior to that one and links to that version of the file. In the first version of the file, the commit object will not refer to any commit prior to that since none exists.
Once an updated version of the file is uploaded to the IPFS, the system creates a new commit object that refers to the prior commit object while linking to the latest version of the file. This is a process that can be done an infinite number of times. IPFS then makes sure that all commits and all versions of the file are available to the system’s different nodes.
These features of IPFS are possible due to something known as Directed Acyclic Graphs (DAGs). This type of data structure means that each node in the network has its own hash for its content. More specifically, the DAG utilized by the IPFS is a Merkel DAG. This is due to the fact that this type of DAG is ideal for representing directories and files.
IPFS Limitations
The IPFS concept is highly promising and is a beneficial alternative to the current system that is the internet of today. However, with all the benefits of the IPFS, several drawbacks and limitations need to be considered.
One limitation of the system is the availability of the files in the system. Every node in the system keeps a cache of the files they have downloaded and helps share this file once a request from another node arrives. If an image, for example, is hosted by two nodes in the system, they are able to share this image with anyone requesting it. However, the problem occurs when the nodes with the file available go offline. If they do this, then there is no way the other nodes in the system can access the file. So, how does the system deal with this problem?
Filecoin
There are actually two different solutions to this problem. One is to incentivize nodes to share the file, and the other is to distribute the file proactively. This is where Filecoin comes into the equation.
The creators of IPFS created Filecoin, and it is basically a blockchain that is built on top of the IPFS network. The goal of Filecoin is to create a decentralized storage market. This means that if you have free space on your hard drive, it is possible to rent this space to others and receive money.
Filecoin then provides an incentive to keep the files online for as long as possible. As long as someone keeps the files online, they will receive rewards. Along with this, Filecoin helps keep several copies of the files on different nodes to ensure that the files are as available as possible.
How is IPFS utilized?
As we previously mentioned, the Turkish government banned Wikipedia in the country. As a response to this, IPFS actually decided to put the Turkish Wikipedia page in the system. Since this storage system does not have one single point of failure like the internet, the government could not take down the site. The page was not stored in a single place, meaning that there is no single server to take down.
Along with this, another exciting area where the IPFS is utilized is something called DTube. DTube stands for “decentralized tube”, and it is a website mimicking YouTube, but it is decentralized. This means that videos on the platform can be uploaded using the IPFS.
Furthermore, some other examples are PeerPad, a service that allows you to write directly in your browser and share the documents through the IPFS. This service is similar to what Google Docs provides.
And lastly, the final example berty.tech, which is an IPFS-based messaging system. This system aims to ensure that messages are sent directly between devices and avoid the messages passing through servers. Along with this, the service will also work on local networks even without an internet connection.
InterPlanetary File System (IPFS) Summary
The internet is one of the most revolutionizing inventions and is a necessity for our society today. The internet has a lot of positive features such as the speed at which we can acquire information and the amount of entertainment available.
However, along with the positive aspects of the internet, there are also some negatives. One issue with this system is censorship. Since information is stored on servers owned by companies or other organizations, it is easy to censor this content from its users. Furthermore, the internet provides a single point of failure. This means that if a server goes offline, the information is unavailable until the server is back online.
An alternative solution to solving these problems with the internet is the InterPlanetary File System (IPFS). The IPFS is a decentralized file-sharing/storing system that functions through a P2P network. In this system, files are not stored on servers but are held by the system’s nodes and shared between them. To enable this, the system uses content-based addressing, which means that files are located based on content and not location as on the internet today.
Through this system, the weak points of censorship and a single point of failure can be eliminated. However, although the InterPlanetary File System has challenges of its own, the solution to these are within reach.
If you would like to learn more about decentralization, blockchain, and the world of crypto, you can tune in to the number one blockchain education platform Ivan on Tech Academy. You will find several blockchain courses that are suitable for both novice and more experienced developers on the website.