4
2
I've read and watch about merkle trees but can't figure out how to implement is_present(element) method. Explainations and links are accepted.
4
2
I've read and watch about merkle trees but can't figure out how to implement is_present(element) method. Explainations and links are accepted.
6
I've read and watch about merkle trees but can't figure out how to implement is_present(element) method.
This takes O(n) time and space, where n is the number of elements in the merkle tree.
You can create a proof that a particular element is in a tree. This proof takes O(log n) space to store, and O(log n) time to verify, but still takes O(n) time to construct.
Construction:
Verification:
If the merkle tree is in sorted order, you can also create a proof that an element is not in the merkle tree. It works in a similar way, except that you find the two elements that would have been the neighboring elements. Then, you prove that both are in the tree, and that they are next to each other.
for me the most tricky part is finding "buddy". Can you explain how to find it? – ka4eli – 2016-11-06T08:32:27.353
3A tl;dr: you don't check whether something is present in a Merkle tree. You ask the party who claims that something is in it to prove to you instead. – Pieter Wuille – 2016-11-06T21:19:30.910