IPFS is a distributed file system. It combines ideas from Kademlia, Bittorrent, Git,and Self-Certified Filesystems, taking respectively 1) routing and node identity, 2) block exchange, 3) Merkle tree-based verification and versioning, and 4) self-certification - addresses derived from public keys.
The result is something like a DHT that stores Git objects and uses the Bittorrent protocol for distribution. The certificate system, which does not rely on a trusted 3rd party to map addresses to public keys, is another major feature, allowing public-key encryption and ensuring that a malicious node can’t impersonate a node that has already established trust.
The block exchange protocol, called BitSwap, is a modified version of Bittorrent’s. Bittorrent provides incentives for seeding - the standard seeding strategy is to prioritize seeding to the n peers that are themselves the best seeders. BitSwap is similar, but the choice of which peers to seed to is probabilistic, depending on that peer’s ratio of sent:received objects. Since this probability is based on lifetime ratios, a peer can stop uploading for a short time and not have its download rates affected much.
Bittorrent also encourages the sharing of rare pieces by making sure that rare pieces are requested first. If this is a demand-side incentive - demand is increased for rare pieces - BitSwap’s solution is supply-side - peers are encouraged to seek objects that their peers also want. This allows a peer to contribute even if it currently does not want any objects.
The file system itself is implemented as a Merkle DAG, very similar to Git’s. Objects have links to other objects, represented as their hashes. Tree
objects represent directories, blob
s data, and commit
s represent snapshots of a collection of objects in some state. IPFS, unlike git, also has list
s, which can contain blobs or other lists. Like Git, objects are deduplicated because they are addressed by their hashes. They are also immutable and permanent: once mutated, an object’s hash changes, and there is no command in the protocol to delete the previous version.