Skip to content

@circom:tree.verify

Verify a Poseidon Merkle inclusion proof against a root, using the path index and siblings produced by @circom:tree.proof.

⚗️ Experimental — available at next.evmcrispr.com.

Returns: bool

@circom:tree.verify(root leaf index proof lean:<value> depth:<value>)
NameTypeDescription
rootnumberMerkle root
leafnumberLeaf to prove
indexnumberPath index from @circom:tree.proof (equals the leaf index for fixed-depth and complete lean trees)
proofarrayArray of sibling field elements, leaf to root
lean:boollean:true — Semaphore v4 LeanIMT (the default when depth: is not set)
depth:numberdepth:<n> — zero-padded fixed-depth tree
# Check a member's inclusion proof off-chain
set $leaves [1234 5678 9012]
set $root @circom:tree.root($leaves)
set [$index $siblings] @circom:tree.proof($leaves 2)
print "Member included:" @circom:tree.verify($root 9012 $index $siblings)
  • index is the path index returned by @circom:tree.proof, not necessarily the leaf position (they differ for incomplete lean trees).
  • Fixed-depth proofs must have exactly depth siblings.