Skip to main content

What is IPFS?

This article gives you a high level view of what IPFS is.

IPFS (InterPlanetary File Service) is a technology for reading and writing files stored on peer-to-peer distributed nodes.

Location Addressing

When you browse or download a file on the Internet via a URL you are looking it up based on its location. The URL references a server or group of servers on a domain (like example.com). The domain is usually tied to a person or an organization. If the servers are attacked, the domain is shutdown, someone forgot to pay their domain or hosting bill, or the host provider decides to suspend the account – then you can no longer access any file under that domain.

One area where this can be a problem is with an NFT (Non-Fungible Token). NFTs are not stored on most blockchains (like Ethereum) because they are too large. Instead an address for the file is stored as part of the transaction. If this is a URL, that could be a problem if the server at the location disappears. You may have spent hundreds if not millions of dollars for a work of art – and now it is gone. Another problem is that a malicious person could modify the file altering what you originally paid for.

Content Addressing

When you browse or download a file on IPFS you are using a CID (Content Identifier). This is a unique address that references the file on a peer-to-peer network. The CID itself is not a hash of the contents. Though if you look at a CID you may think it is a hash. It’s a bit more complicated than that. All you need to understand at this point is that the CID is meant to be unique. IPFS is designed to make sure that no two pieces of content ever map to the same address.

Going back to an example of an NFT. Instead of using a URL to reference artwork, most NFTs reference an IPFS CID. There are a number of reasons. The first being that the content at the address can not be changed. If someone changes the content and adds it to IPFS the changed content will have a different CID. The second being that once the owner of the artwork knows the CID they can “pin” it. I will explain that next.

What is IPFS pinning?

When you add a file to IPFS there is no guarantee that it will not be garbage collected (deleted). To keep a file from being deleted you need to pin it on a node. You could do something like run a local node on your laptop or a Raspberry Pi or server in your basement. But if the machines are turned off, damaged or you lose your Internet connection no one else can access it.

You may still be in luck if someone else pinned the file on their node. But you have no control on what other people do or what happens to their nodes.

If it is really important to pin a file on IPFS I would use a service or host my own node on a cloud server. Of course if you only pin it in one place you still have a single point of failure. So you may want to pin it in multiple places. That way if you lose one node, you still have other nodes holding it in place.

What can you store on IPFS?

Besides files you can also store folders on IPFS.

Can you host a Web site on IPFS?

Yes, you can host a Web site on IPFS. You can post a folder of content or even just a single page HTML site and map a domain to it. But when you change the contents the CID will change and you will have to update the map. I’ll put a link to how to do that in the references section below.

How can you access IPFS files and folders?

You can access IPFS files and folder several ways:

  • Install a local node and access if through the command line
  • Install the IPFS desktop
  • Use a browser that supports the IPFS protocol
  • Use a browser extension that supports the IPFS protocol
  • Browse to a CDN URL that accesses IPFS files
  • Use an IPFS cloud service
  • Use a programming library

See the references section below for more info.

Conclusion

In this article you learned that IPFS is a way to store and retrieve files and folders on the Internet using content based addressing. You also learned that it is how many NFTs are stored and that you can use it to host a Web site.

References