The InterPlanetary File System

The InterPlanetary File System, IPFS for short. A cool name, but what does it do?

Distributed

IPFS is part of the distributed web movement, sometimes referred to as “Web 3.0”. While “Web 2.0” is the social web we all got used to, “Web 3.0” is the idea we need to move from a decentralized to a distributed network.

Centralized, Decentralized & Distributed Systems
On Distributed Communications Networks, Paul Baran, 1964

The current internet is a decentralized system: a few big nodes control most of the internet. Think of Facebook, Google, Amazon. What happens if one of these services is not available? What about AWS or Google Cloud, what if those go down? What if they don't only go down but disappear? Remember GeoCities, MySpace, TwitPic? What if your government blocks access to Twitter, Wikipedia? A decentralized web could be more resilient, more difficult to censor. IPFS is one possible cog in the distributed web machine.

Supersede HTTP

IPFS aims to supersede HTTP. The current internet is location-based, a URL tells you where a document lives, not its content. The content disappears if the URL breaks (yeah, that never happens). Information gets lost. IPFS, is different, it's content, not location-based. You don't ask it to fetch the document at this location, you ask it to fetch this document and it will figure out where to get it from. As long as someone has a copy it will find it.

Gateways

The easiest way to access IPFS is by using one of the gateways. https://ipfs.io/ipns/ipfs.io loads the IPFS website from… IPFS. https://cloudflare-ipfs.com/ipns/ipfs.io does exactly the same but uses Cloudflare's gateway. This is all fine but it's still a decentralized system, not a distributed one. It still depends on the availability of these gateways.

Gateways are stopgaps, they bridge the HTTP and IPFS worlds. They make it easy to quickly load a document from IPFS but you, the visitor, are not actively contributing to the network.

Your own node

IPFS can be installed on any computer. Your computer now becomes a node, an active participant on the distributed web. It will keep a copy of the content you load form IPFS and serve it to others when they ask for it. The more popular a file, the more peers will cache the file and the fast it will load when someone needs it (since there is a good chance someone close to you already has it). Just like BitTorrent.

You'll need an IPFS aware browser to really take advantage of the InterPlanetary File System. Your Chrome or Firefox browsers have no idea those IPFS links above are something special. It's still plain old HTTP.

Add the IPFS Companion to your browser and visit ipfs.io again. The URL should now change to http://127.0.0.1:8080/ipns/ipfs.io, otherwise known as your very own computer. Congratulations, you are now part of the distributed web!

Pinning

A node does not keep these copies around forever, it will remove older copies if it runs out of allocated disk space. This means our precious documents will still vanish if people stop sharing them. That's where pinning comes in. You can choose to pin a document, telling IPFS that this is a file you want to keep around. Your local node will keep that copy around forever (or until you unpin it) and serve it to anyone requesting it.

There still is an issue here, what if your node is not online? Your laptop isn't always connected to the internet. The most decentralized solution would be to have your own server pinning the same content (as in “a machine always connected to the internet”), but there are some commercial services available as well: Pinata or Temporal.

This post is open source. Did you spot a mistake? Ideas for improvements? Contribute to this post via Github. Thank you!