Merkle Proofs

Trust Hub builds a Merkle tree over all ledger entries using SHA3-256. This enables compact inclusion proofs: proof that a specific entry exists in the ledger without downloading the entire chain.

Generating Proofs

from trusthub.ledger.integrity import generate_inclusion_proof

proof = generate_inclusion_proof(store, entry_id)
print(f"Root: {proof.root_hash}")
print(f"Path: {len(proof.proof_hashes)} nodes")

Verifying Proofs

from trusthub.ledger.integrity import verify_inclusion_proof

is_valid = verify_inclusion_proof(proof)
print(f"Proof valid: {is_valid}")