Summary
In this chapter, we have studied IPFS. We started by looking at the motivations of the IPFS project and its history. Although IPFS is not a part of the blockchain technology, it is similar to blockchain because it complements blockchain technology. We then learned about the data structure of the content that we saved in the IPFS filesystem. This data structure is Merkle Directed Acyclic Graph (DAG), which is based on the Merkle tree. We created simple Merkle tree and Merkle DAG libraries to understand the uniqueness of these data structures. Merkle trees provide an easy way to check the integrity of partial data, while Merkle DAGs are used when we want to save a directory with files and we want to keep the filenames. Then, we learned about the peer-to-peer networking aspect of a Kademlia distributed hash table. The distance between nodes is based on the XOR distance. The nodes also are kept in buckets, which corresponds to bit addressing. Finally, we showed how a node can find...