{"id":"merkle-root-compute","version":"1.0.0","description":"Compute a Merkle tree root (RFC 9162 or Bitcoin) from a leaf list, with an optional audit path.","supported_operations":["compute a certificate transparency merkle root","bitcoin block merkle root from txids","rfc 9162 tree hash","merkle root of these leaves","ct log merkle tree hash","build an audit path for a leaf"],"unsupported_operations":["verifying an inclusion proof without the full leaf list (see merkle-proof-verify)","RFC 9162 consistency proofs between two tree sizes"],"semantics":["scheme 'rfc9162': each element of leaves is raw leaf DATA as hex (not pre-hashed); MTH is applied per RFC 9162 2.1.1, including the empty-tree case (leaves: [] -> root = SHA-256(''), leaf_count 0).","scheme 'bitcoin': each element of leaves is a txid as 64 lowercase hex characters in DISPLAY order; the tool reverses each to internal order, pairs them with double-SHA-256, duplicates the last hash of any odd-length level, repeats until one hash remains, then reverses the result back to display order. An empty leaves array is not_computable (Bitcoin blocks always have >= 1 transaction).","A single leaf's root equals its own (hashed, for rfc9162; unhashed but reordered, for bitcoin) value.","proof_index (optional), when given, must satisfy 0 <= proof_index < leaves.length; the tool returns audit_path as that leaf's RFC 9162 2.1.3.1 Merkle audit path (leaf-to-root, hex) for scheme rfc9162, or the equivalent Bitcoin merkle branch (display-order sibling hashes) for scheme bitcoin. When proof_index is omitted, audit_path is null.","leaf_count is leaves.length in the input, echoed back for convenience.","Limits: leaves has at most 1024 entries (max_leaves), and the decoded leaf bytes summed over all entries are at most 65536 (max_total_leaf_bytes; each entry is therefore at most 131072 hex characters, and a bitcoin tree of 1024 txids is 32768 bytes). Both are checked before any hashing and fail with limit_exceeded. Bitcoin blocks with more than 1024 transactions are out of coverage.","root is always a 64-hex-character string (the empty rfc9162 tree has the defined root SHA-256(''); the empty bitcoin case is not_computable), never null."],"limits":{"max_leaves":1024,"max_total_leaf_bytes":65536},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["scheme","leaves"],"properties":{"scheme":{"type":"string","enum":["rfc9162","bitcoin"]},"leaves":{"type":"array","maxItems":1024,"items":{"type":"string","maxLength":131072,"pattern":"^([0-9a-f]{2})*$"}},"proof_index":{"type":"integer","minimum":0}}},"output_schema":{"type":"object","additionalProperties":false,"required":["root","leaf_count","audit_path"],"properties":{"root":{"type":"string","pattern":"^[0-9a-f]{64}$"},"leaf_count":{"type":"integer","minimum":0},"audit_path":{"type":["array","null"],"items":{"type":"string","pattern":"^[0-9a-f]{64}$"}}}},"examples":[{"input":{"scheme":"rfc9162","leaves":[]},"output":{"root":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","leaf_count":0,"audit_path":null}},{"input":{"scheme":"bitcoin","leaves":["4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"]},"output":{"root":"4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b","leaf_count":1,"audit_path":null}}],"execute_url":"/v1/tools/merkle-root-compute/versions/1.0.0/execute"}