Standalone

Merkle Proofs

close button

Part II

Verifying Merkle Proofs

Now that you have figured out how to get a Merkle root, you need to implement on-chain verification.

In other words, there must be a way for the smart contract to validate a proof, and confirm that a given address is indeed a member of the Merkle Tree.

Your Task

Implement verify(address trustee, bytes32[] proof) in your SacredTree contract.

  • address: The address to verify

  • proof: The merkle proof needed to verify trustee’s membership in the merkle tree, as an array of hashes in a bottom-up order

For example, consider the following Merkle Tree.

merkle_proofs_02.webp

To verify addressA, we can make the following function call:

verify( addressA, [hashB, hashF] )

Run tests in Questplay

Submit work in Questplay

As the new Merk’l tree takes root, you watch as the monks begin to re-engrave their history upon it, including their elusive list of trusted allies.