About IPFS

The InterPlanetary File System (IPFS) is a distributed file storage protocol that allows computers all over the world to store and serve files as part of a giant, peer-to-peer network.

You’re a Client. And a Server.

Every single computer that’s running IPFS acts as both a client and a server. In other words, each computer running the IPFS software can serve content to any other computer in the network, as well as request content from anyone in the network. So if you run IPFS on your computer and upload a picture to the IPFS network, that image can be viewed and downloaded by anyone else in the world who is also running IPFS.

Addressing

Every file added to IPFS is given a unique address derived from a hash of the file’s content. IPFS addresses are multihashes, which combine information about the hashing algorithm used as well as the hash output into a single string. Each multihash has three distinct parts. The first byte of the mulithash indicates which hashing algorithm was used to produce the hash, the second byte indicates the length of the hash, and the remaining bytes are the output of the hash function. IPFS currently uses the SHA-256 algorithm, which produces a 32-byte hash. By default all IPFS hashes are encoded in Base58, a binary-to-text encoding scheme popularized by its use in Bitcoin addresses. Base58 has the advantage that letters that might be mistaken for each other in certain fonts (e.g. zero and the capital letter O) have been omitted.

An IPFS address encoded with this scheme is going to look something like this: QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco.

Let’s break that string down. The “Qm” prefix generally indicates that this address was produced using the SHA-256 algorithm and will be 32 bytes long. The remaining 44 characters are the hash produced by the SHA-256 algorithm. The whole address, like any address produced using that algorithm and rendered in Base58, is 46 characters long. This particular address happens to be the the address of a folder that contains a full copy of Wikipedia from May of 2017.

Who Stores What

How do you know who’s hosting a given piece of content? IPFS relies on a distributed hash table (DHT), i.e., a mapping from hash to some people who may have the content addressed by that hash. The hash table is distributed because no single node in the network holds the whole thing. Instead, each node stores a subset of the hash table, as well as information about which nodes are storing other relevant sections.

Viewing Content

Once you know the address of a piece of content you want to view, you need a way to access the IPFS network.

The easiest way is to use an IPFS gateway, a web-based interface that allows you connect to the IPFS network over HTTPS, without actually having to be a node in the IPFS system yourself. When you connect to an IPFS gateway, you’re really connecting to an IPFS node that’s managed by a third party. To learn more about how to browse the distributed web using Cloudflare’s gateway (and view that distributed version of Wikipedia), check out Browsing IPFS.

Connecting Your Website

If you want to make files located on the IPFS accessible from a custom domain name, you can do that using Cloudflare’s Distributed Web Gateway. To learn how, check out Connecting your Website.

Going Further

If you’re interested in learning more, you can read the official IPFS documentation at https://ipfs.io/docs/.

You should also read our Terms of Use, as it governs your use of the Cloudflare IPFS gateway.