recompute_merkle_root
Recompute a Merkle root from a leaf and proof path to verify data integrity locally. Compare against expected root to detect tampering.
Instructions
Trustlessly recompute a dokimo-merkle-v1 root — LOCAL, no network, no trust.
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. |