In order to explain why libp2p is such an important piece of the decentralized web, we need to take a few steps back and understand where it came from. libp2p's initial implementation began inside of IPFS, a peer-to-peer file sharing system. Let's start by exploring the networking problems that IPFS was built to tackle.
We've grown to love the internet and use it in many aspects of our everyday lives, for studying, connecting with friends and family, shopping, managing our finances, and much more.
We've become dependent on the internet to a point where we really need it to be reliable and safe, but that's not really the case in this day and age. We've all experienced connectivity issues, and we also feel that our identity and data are not safe across the multiple online services that we use daily.
For example, if you want to send a photo to a friend that lives in the same street, the number of service providers the photo passes through is too high: your phone will capture the image and send it through the network until it reaches the application servers (possibly overseas); the server will then store the photo in a database, analyze it for facial recognition to suggest tagging friends in the picture, and send a notification to your friend's device; and finally your friend will check the notification and load the photo from the overseas database.
There are so many things that can go wrong in this scenario, and the truth is, you probably didn't want the photo to be stored in some far away database which you can't delete. You just wanted to share your photo directly with your friend.
A lot of the issues that we face come from using a location addressing approach to find the content the user is looking for, and serving it from that address. For example, we expect our libp2p logo to be available at https://proto.school/tutorial-assets/T0009L01-libp2p-logo.svg, but what if the server of this website is down? What if the DNS server is down? What if the image was converted to a PNG file and so the new location is
T0009L01-libp2p-logo.png? What if you are in a country that has blocked the
All of these issues are common ones and are caused by location addressing, where we try to find the content we need by its location.
IPFS, however, approaches this problem in a different way by using content addressing instead. If we know the CID (Content IDentifier) of our libp2p logo instead of its location, we can simply ask the network who has the image with this CID. The advantages in this approach are very appealing since they solve all the other issues previously mentioned, but to get it right there are other problems that need to be tackled first, specifically within networking.
To have a web powered by
Content Addressing, we need to redesign and re-imagine how computer networks work.
Networks are very complex systems that have their own rules and restrictions, and so when designing these systems, we need to take into account a lot of situations and use cases:
Ouch, this is a long list! But these are the issues that IPFS had to solve in order to create successful P2P (Peer-to-Peer) communications.
The truth is, as we will see in the next lesson, IPFS is not the first project to try and solve these issues and create a P2P network.