Skip to main content

Verify Commitment Inclusion

Build a sorted-pair Merkle tree, derive a proof for one Block hash, and verify its inclusion against the Merkle root hash. A valid proof confirms only that the Block hash is included in the leaf set represented by that root.

Before You Start

Use the JavaScript Merkle helpers with valid lowercase 0x-prefixed 32-byte leaves. Synthetic Block hashes keep the example independent of production data and network access.

How It Works

  1. Build a Merkle tree from normalized Block hashes.
  2. Select a leaf and derive its sibling path.
  3. Verify its inclusion against the Merkle root.
  4. Change the leaf or proof and confirm verification fails.

When to Use This Workflow

Use an inclusion proof when a verifier has a trusted Merkle root and needs to check one Block hash without loading every leaf.

Use the repository root with workspace dependencies installed; no network or deployed contract is required.

The example imports Block and Merkle helpers directly from the repository source and executes entirely off-chain.