OpenZeppelin – Using OpenZeppelin Merkle Proof Library

merkleizationopenzeppelin

I want to use the OpenZeppelin Merkle proof library, but I am not able to figure out the hashes I have to provide in the proof parameter in the verify function of the library.

Let's say I have these hashes as leaf nodes:

[
{hash: 'b21bf46774e26d1371efa237de5882f526119eecaa45dbf39c7818600e375e2d'},
{hash: '3da8c00fbec86f6ede0cca827e032dc7ebbe839dc80dc97b862df3d3aec8b78d'},
{hash: '5a9c997d4c2508b4e29870855eab0d80b39952d024c716505066d8705070947b'},
{hash: '8f4082b2891ad69b64b2c4753dae488d6666d4d7cfd34d87c67efb2b9fde8a3c'},
{hash: '815fdfa8e1af3674398bb50aa2023bc2eee26ad0effa73fbc6e8bfca6d0d3d32'},
{hash: '9d282b8f2019001b06c0f6ab08989dd39403459da38c8c56c908ac59c543989c'},
{hash: '9847b72c2efe0fc6d7bddcf948de2a8c87f12e25e09c66cf01168a904addf4c9'},
{hash: '2ff257c0d15996467140c11a3076bc56b4d85e32d93437608d6728a46b15045c'},
{hash: '664bbbb4b2835f058a4c618707cb2103b15a602aca55d00f764d546fd262e529'},
{hash: '039f9def43c7130659dbe112ab4ed877964b253cea54ece430c013154e1ed1ab'}
]

Then what all hashes I will have to provide in the proof parameter.

Best Answer

Using example https://blog.ethereum.org/2015/11/15/merkling-in-ethereum/

  • proof would be the yellow hashes.
  • root is 6c0a...
  • leaf is the green hash.

enter image description here

Of course if your leaf is different, the proof hashes will be different.

Related Topic