# InterPlanetary File System

June 25, 2020 · David Lick

What will the Internet look like for colonists on Mars? It seems like a silly question since we’re far away from having boots on the ground on our red planet neighbor. We’ll likely need a moon base, which is itself likely decades away, before we can even think about attempting a manned trip to Mars. The problem is Mars is so far away the best possible latency is around 16 minutes round-trip. So if you want to check your Twitter and the servers are here on Earth.. you’re going to wait a very long time between page loads.

Enter the InterPlanetary File System. IPFS, designed by Protocol Labs, is part of a growing movement to decentralize the Internet which has wide reaching implications from resiliency to durability to availability and with that protection from censorship.

Simply, IPFS is a protocol that allows content-addressing instead of location-addressing. What that means is you make a request for specific files and you could get them from someone across the world or it could come from someone in your neighborhood. Additionally, each user of IPFS is another node in the network which can serve content. So in our Mars colony thought experiment, if anyone on Mars has downloaded content from Earth they become the closest seed for that content to all the users on Mars. Here on Earth, that means we can reduce loading times for content by fetching from nodes close to us. It also means that if one node is unreachable, you’ll simply reach out to the next closest node for your content. IPFS can replace a portion of the HTTP traffic of the internet today since IPFS is particularly well suited for static content. However, it doesn’t have to exclusively replace it. IPFS is just another tool in the toolbox to be used when applications or content need to be highly available, resilient and durable.

### Architecture#

I’ll keep this pretty high-level since the IPFS white paper goes in-depth of how the protocol works. IPFS relies on several key technologies born and evolved since the introduction of HTTP.

### Coordination#

Looking up which nodes are serving the content you want is powered by distributed hash tables or DHTs. DHTs have been used in other widely distributed systems such as BitTorrent to track peers.

### Hashing#

Hashing is at the heart of what makes IPFS tick. Hashes are generated from file contents that uniquely describe what a file is. Hashes are exceptional for this because a single bit changed in a file will drastically change the hash output. This means we can uniquely describe an entire file with a short string of characters.

### Merkle Trees#

Merkle trees are the core technology used in version control systems for history tracking. IPFS uses them to similar ends as well as some interesting emergent features.

Everything in IPFS is described by a cryptographic hash. Folders are hashed by their contents and if that folder contains other folders they will be described by hashes of their contents. So on and so forth. Since all objects in the Merkle tree are described by their hashes, all files in IPFS are immutable. When a file is changed the previous version remains and the updated version is added. Both versions will have their own addresses.

Finally, since files are described by their hashes it’s trivial to check that a file has been altered, whether maliciously or not. You simply hash the file and if the checksums do not match, you throw the file away.

### Installing and Using IPFS#

There’s an excellent primer on installing and using IPFS here. Protocol Labs have done an excellent job creating useful command line tools as well as desktop applications for making accessing the network seamless and easy. IPFS Desktop is a convenient application which runs a local IPFS node which you use to access ipfs://, ipns:// and dweb: links as well as serve your own content to the network.

Brave, which I highly recommend for their privacy protection focused browser, have added an IPFS Companion toggle in their settings to enable IPFS… no need to install anything.

### IPFS-Based DApps#

Since IPFS is still relatively new discovery on the network is still difficult. There are no great search engines just yet. Awesome IPFS is a neat place to find new tools and content hosted on IPFS.

Some cool applications I’ve come across:

### DTube #

A distributed YouTube alternative. There’s not a lot of content yet but as a PoC it shows that we definitely don’t need Google for a video service like YouTube.

### killcord #

Not sure I really have use of a deadman’s switch but the concept is very cool!

### Diffuse #

A cool in browser music player that supports playing content from IPFS as well as S3, Blockstack, Dropbox and other remote storage.

### OpenBazaar #

OpenBazaar is a decentralized e-commerce platform built on IPFS which allows you to buy and sell with Bitcoin.

### Conclusion#

I’ve only started scratching the surface of what IPFS can do. It makes me really excited for the future of the Internet. If it takes off it has the potential to wrench control of the Internet away from the few super large companies and put it back into the hands of the users. The worst case scenario for IPFS is it’s used to make the Internet more durable, resilient and available. I’m brainstorming project ideas to build on top of the protocol. I’ll write a post later when I have something cool to show off and in the meantime, I’m excited to see what others come up with!