recompute_merkle_root
Recompute a dokimo-merkle-v1 root locally from a leaf and proof path to verify an evidence package; if the result differs from the stated root, the package was tampered with.
Instructions
Recompute a dokimo-merkle-v1 root locally — no network call, no anchor check.
Hash leaf in the leaf domain (H(0x00 ‖ leaf)) and replay proof_path —
a list of [sibling_hash, side] where side is "L" or "R" — hashing internal
nodes as H(0x01 ‖ left ‖ right). Compare the returned root to the root in an
evidence package yourself; if it differs, the package was tampered with.
Returns {recomputed_root, merkle_scheme, steps}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| leaf | Yes | The raw leaf value (e.g. a JSON string like '{"k":"total_assets","v":"..."}'). Hashed in the leaf domain as H(0x00 ‖ leaf). | |
| proof_path | Yes | Ordered Merkle proof path: a list of [sibling_hash_hex, side] pairs, where side is "L" if the sibling is on the left or "R" if on the right. Empty list for a single-leaf tree. |