Merkle Trees as a vector commitment #
Notes & TODOs #
We want this treatment to be as comprehensive as possible. In particular, our formalization should (eventually) include all complexities such as the following:
- Multi-instance extraction & simulation
- Dealing with arbitrary trees (may have arity > 2, or is not complete)
- Path pruning optimization
Add a base layer to the cache
Instances For
Returns the leaves of the cache
Instances For
Compute the next layer of the Merkle tree
Instances For
Get the root of the Merkle tree
Instances For
Generate a Merkle proof that a given leaf at index i is in the Merkle tree. The proof consists
of the Merkle tree nodes that are needed to recompute the root from the given leaf.
Instances For
Given a leaf index, a leaf at that index, and putative proof, returns the hash that would be the root of the tree if the proof was valid. i.e. the hash obtained by combining the leaf in sequence with each member of the proof, according to its index.
Instances For
Verify a Merkle proof proof that a given leaf at index i is in the Merkle tree with given
root.
Works by computing the putative root based on the branch, and comparing that to the actual root.
Outputs failure if the proof is invalid.
Instances For
Building a Merkle tree never results in failure (no matter what queries have already been made to the oracle before it runs).
A purely functional version of buildLayer, given an explicit hash function.
Instances For
A purely functional version of buildMerkleTree, given an explicit hash function.
Instances For
A purely functional version of getPutativeRoot, given an explicit hash function.
Instances For
A functional completeness theorem for Merkle proofs built from buildMerkleTree_with_hash.
Completeness theorem for Merkle trees: for any full binary tree with 2 ^ n leaves, and for any
index i, the verifier accepts the opening proof at index i generated by the prover.