Skip to content

Instantly share code, notes, and snippets.

@johnson86tw
Created June 14, 2021 05:15
Show Gist options
  • Save johnson86tw/771b4609962047fc8c0c9e96978eebfd to your computer and use it in GitHub Desktop.
Save johnson86tw/771b4609962047fc8c0c9e96978eebfd to your computer and use it in GitHub Desktop.
// prover
const levels = 2;
const leaves = [10, 20 ,30 ,40];
const tree = new MerkleTree(levels, leaves);
const index = 2;
const proof = tree.proof(index);
// verifier
const root = "117086588437903260255921638146322982"
console.log(verify(proof, root)); // true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment