Merkle Proofs
A Merkle proof demonstrates that a Block hash is included in the leaf collection represented by a specified Merkle root hash. Applications can verify inclusion using only the Block hash, the proof, and the trusted Merkle root without loading the entire tree.
Merkle Proof Model
ALX orders each pair of bytes32 values before hashing with Keccak-256. Because every implementation applies the same ordering rule, proofs do not need to record left or right sibling positions, and equivalent inputs produce the same Merkle root.
Proof Verification
To verify a proof:
- Start with the Block hash.
- Combine the current hash with each sibling hash in the proof.
- Order the pair deterministically.
- Hash the pair with Keccak-256.
- Repeat until every proof element has been processed.
Verification succeeds when the final computed hash matches the expected Merkle root. An empty proof succeeds only through direct equality between the Block hash and Merkle root.
When to Use a Merkle Proof
Use a Merkle proof when a verifier trusts a Merkle root but does not need every Block hash in the tree. A successful proof confirms only that the Block hash is included in the leaf collection represented by that Merkle root.