merkle_tree v2.0.0 MerkleTree.Proof
Generate and verify merkle proofs
## Usage Example
iex> proof = MerkleTree.new(~w/a b c d/) |>
...> MerkleTree.Proof.prove(1)
["40e2511a6323177e537acb2e90886e0da1f84656fd6334b89f60d742a3967f09",
"022a6979e6dab7aa5ae4c3e5e45f7e977112a7e63593820dbec1ec738a24f93c"]
iex> MerkleTree.Proof.proven?({"b", 1}, "9dc1674ae1ee61c90ba50b6261e8f9a47f7ea07d92612158edfe3c2a37c6d74c", &MerkleTree.Crypto.sha256/1, proof)
true
Link to this section Summary
Functions
Generates proof for a block at a specific index
Verifies proof for a block at a specific index
Link to this section Types
Link to this section Functions
Link to this function
prove(root, index)
prove(MerkleTree.t() | MerkleTree.Node.t(), non_neg_integer()) :: proof_t()
Generates proof for a block at a specific index
Link to this function
proven?(arg, root_hash, hash_function, proof)
proven?( {String.t(), non_neg_integer()}, String.t(), MerkleTree.hash_function(), proof_t() ) :: boolean()
Verifies proof for a block at a specific index