Interplanetary File System (IPFS)
The Interplanetary File System (IPFS) is a peer-to-peer file storage network. Instead of storing files on a single server (the way traditional web hosting works), IPFS distributes files across many computers around the world.
Any computer can join the IPFS network by installing the IPFS software and start hosting and serving files.
If someone uploads a file to the IPFS network, anyone else running IPFS can view and download that file — no central server is involved.
Every file added to IPFS is given a unique address derived from a hash of the file's content. This address is called a Content Identifier (CID). A CID contains two pieces of information: the hash of the file and an identifier for the hash algorithm used, combined into a single string.
Because the CID is derived from the content itself, two identical files always produce the same CID, and any change to a file produces a different CID. This is what makes IPFS "content-addressed" — you look up files by what they contain, not by where they are stored.
IPFS uses SHA-256 ↗ by default, and encodes the result with Base58 ↗ — an encoding scheme that omits visually ambiguous characters (such as zero and the capital letter O) to reduce transcription errors.
A CID typically looks like: QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco
IPFS also supports other encodings (Base32 ↗) and hash algorithms (SHA-3 ↗, BLAKE2 ↗).
IPFS tracks which computers have which files using a Distributed Hash Table (DHT) ↗ — a lookup system that maps CIDs to the network addresses of computers hosting that content. No single computer holds the entire lookup table. Instead, each computer in the network stores a portion of it and knows where to find the rest.
"Uploading" content to IPFS does not mean sending your file to a central server. It means announcing to the network that you have the content by adding an entry to the DHT that maps your file's CID to your network address. When someone else wants to download that file, they look up the CID in the DHT, find your address, and download the data directly from you.
Because multiple computers can host the same file, downloads are spread across all of them. If any one host goes offline, the others continue to serve the content. This redundancy is what gives IPFS its speed and reliability advantages over single-server hosting.
You can upload more than just individual files. For example, consider a folder called example, which has exactly one file, example_text.txt, containing the string I'm trying out IPFS.
If that folder were uploaded with the command ipfs add -r ./example, both the folder and the file it contains would have their own CID. In this case, the folder would have the CID QmdbaSQbGU6Wo9i5LyWWVLuU8g6WrYpWh2K4Li4QuuE8Fr while the file would have the CID QmXnnyufdzAWL5CqZ2RnSNgPbvCc1ALT73s6epPrRnZ1Xy.
You could then access the file in two ways:
- Requesting the file directly:
https://cloudflare-ipfs.com/ipfs/QmXnnyufdzAWL5CqZ2RnSNgPbvCc1ALT73s6epPrRnZ1Xy - Requesting the file by name, from the directory:
https://cloudflare-ipfs.com/ipfs/QmdbaSQbGU6Wo9i5LyWWVLuU8g6WrYpWh2K4Li4QuuE8Fr/example_text.txt
While the CID of a file will only change if the file itself changes, the CID of a directory changes any time any of the files in it change, or if any files are added/removed.
Directories make it possible to address an entire static website with a single CID and access different pages of the website by requesting different files in the directory.
For help with additional concepts, refer to the IPFS ↗ documentation.