Skip to content

A simple Merkle tree CLI tool written in Rust. Useful for learning about Merkle proofs and preparing inputs for Zero-Knowledge (ZK) circuits - Noir

Notifications You must be signed in to change notification settings

sanjay-sol/merkle-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

5 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Merkle CLI Tool

A simple Merkle tree CLI tool written in Rust. Useful for learning about Merkle proofs and preparing inputs for Zero-Knowledge (ZK) circuits - Noir


๐Ÿ› ๏ธ Usage

1. ๐Ÿ”ง Initialize Merkle Root

Generate and print the Merkle root from a file of addresses:

cargo run -- init --input addresses.txt

Example output:

โœ… Merkle Root: 305d54b0adc42b781c25681011a8ee1ed74e7f0fb1b47fcba44351d9495a02ce

2. ๐Ÿงพ Generate Merkle Proof

Generate and print the Merkle proof for a specific address:

cargo run -- proof --input addresses.txt --address 0x7777777777777777777777777777777777777777

Example output:

๐Ÿงพ Proof for '0x7777777777777777777777777777777777777777':
  [0] 8910... โ†’ right
  [1] 4b06... โ† left
  [2] b92c... โ† left
๐Ÿ’พ Proof saved to proof.json

3. โœ… Verify a Proof

Using a proof file generated above:

cargo run -- verify   --address 0x7777777777777777777777777777777777777777   --root 305d54b0adc42b781c25681011a8ee1ed74e7f0fb1b47fcba44351d9495a02ce   --proof-file proof.json

Expected output:

๐Ÿ”Ž Verification result: true

๐ŸŽฏ Next Steps

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.

About

A simple Merkle tree CLI tool written in Rust. Useful for learning about Merkle proofs and preparing inputs for Zero-Knowledge (ZK) circuits - Noir

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published