How is Merkle Tree(DAG) exactly related to IPFS? I observe that unlike Blockchain, IPFS doesn't require level wise hashing. How all data is hashed in IPFS?


Every Merkle is a directed acyclic graph (DAG) because each node is accessed by its name. Each branch of Merkle is the hash of its local data, because its fast to access instead of accessing by its original content. This will helps to prevents cycles (lets assuming there are no hash collisions), because one cannot link the first created node to the last node to create the last reference.

As per IPFS white paper:

The DHT and BitSwap allow IPFS to form a massive peerto-peer system for storing and distributing blocks quickly and robustly. On top of these, IPFS builds a Merkle DAG, a directed acyclic graph where links between objects are cryptographic hashes of the targets embedded in the sources. This is a generalization of the Git data structure. Merkle DAGs provide IPFS many useful properties, including:

  1. Content Addressing: all content is uniquely identified by its multihash checksum, including links.
  2. Tamper resistance: all content is verified with its checksum. If data is tampered with or corrupted, IPFS detects it.
  3. Deduplication: all objects that hold the exact same content are equal, and only stored once. This is particularly useful with index objects, such as git trees and commits, or common portions of data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.