A simple Merkle tree CLI tool written in Rust. Useful for learning about Merkle proofs and preparing inputs for Zero-Knowledge (ZK) circuits - Noir
Generate and print the Merkle root from a file of addresses:
cargo run -- init --input addresses.txtExample output:
โ
Merkle Root: 305d54b0adc42b781c25681011a8ee1ed74e7f0fb1b47fcba44351d9495a02ce
Generate and print the Merkle proof for a specific address:
cargo run -- proof --input addresses.txt --address 0x7777777777777777777777777777777777777777Example output:
๐งพ Proof for '0x7777777777777777777777777777777777777777':
[0] 8910... โ right
[1] 4b06... โ left
[2] b92c... โ left
๐พ Proof saved to proof.json
Using a proof file generated above:
cargo run -- verify --address 0x7777777777777777777777777777777777777777 --root 305d54b0adc42b781c25681011a8ee1ed74e7f0fb1b47fcba44351d9495a02ce --proof-file proof.jsonExpected output:
๐ Verification result: true
You can now use the generated proof.json and root in your Noir or Circom ZK circuits to prove membership inside a Merkle tree on-chain or privately.