Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

Merkle trees are used extensively in distributed computing. Here's an example: You have many instances serving assets of some kind replicated in several data centers. They are structured in an arbitrary number of branches with many assets in each branch:

  (root)
    |   \
  (foo)  (bar)---(baz)----[even_more_assets]
    |     |
    |  [many_more_assets]
    |
  [many_assets]
How do you make sure the asset trees in the instances are synced up, serving the same assets?

You could compare every bit across every instance, but that would be very inefficient. You could compare the hashes of all the assets at each node of the tree, but you would still end up making many unnecessary comparisons.

You can simply hash each node of the tree based on the hash of its child nodes / assets. This forms a Merkle tree. That way, you can simply compare the root hashes across instances, and if they match, then the whole asset tree must be the same. If they don't match, compare the hashes at the next level of the tree until you find the discrepancy, and sync the nodes / assets where the hashes don't match. Merkle trees can be a very powerful tool for reaching consensus quickly in distributed systems.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: