This script creates a Merkle Tree using the OpenZeppelin Merkle Tree library and allows you to generate a Merkle proof for a given address and amount.
yarn installnode merkle-tree.jsThis will generate a tree.json file and print the Merkle Root.
You can get the Merkle proof for a specific address and amount:
node merkle-tree.js proofValue <address> <amount>Example:
node merkle-tree.js proofValue 0x1234567890abcdef1234567890abcdef12345678 11If the value exists in the tree, it will print the proof.
The default data in the script is:
[
["0x1234567890abcdef1234567890abcdef12345678", "11"],
["0xabcdefabcdefabcdefabcdefabcdefabcdefabcd", "22"]
]You can modify this values array to suit your needs.
tree.json: contains the full Merkle Tree structureconsole.log: shows the Merkle Root or proof result