Standalone

Merkle Proofs

close button

Part I

Building Merkle Trees

Download quests in Questplay

The monks use Merkle Trees to build their verification system. By storing a merkle root in a SacredTree contract, they can verify whether or not an address belongs to their list of trusted addresses.

Here are the details you will need to know:

  • The merkle tree uses the keccak256 hash function

  • The trusted addresses are hashed to form leaves

  • The leaves of the tree are then sorted before the tree is built

  • When building the tree, the pair of hashes are sorted before being hashed together again

Your Task

In data/trustees.js, you will find the entire dataset of trusted addresses. Transform these addresses into a merkle tree, and store the merkle root in the SacredTree contract.

You can leave the verify(...) function empty for now!

Run tests in Questplay

In order for the monks of the Lotus Order to preserve their history, you must aid them in creating a new sacred tree.