Knowledge Base

Browse the concepts behind Truestamp. Follow the links between concepts, or search across everything.

Compact proof encoding

The binary wire form of a Merkle inclusion proof used in a proof bundle's inclusion_proof and epoch_proof fields, packing a depth byte, a left/right direction bitfield, and raw 32-byte sibling hashes into unpadded base64url, mapping losslessly to and from the JSON direction:hash form.

Overview

The compact proof encoding is the binary wire form of a Merkle inclusion proof, used for the inclusion_proof field of a proof bundle and for each commitment’s epoch_proof. It packs the proof into three parts: a depth byte, a bitfield of ceil(depth / 8) bytes holding one left/right direction bit per step, and the raw 32-byte sibling hashes in bottom-to-top order, then wraps the binary in base64url without padding so it can travel inside JSON, a URL, or a header. The encoding is lossless and symmetric: it maps one-to-one to and from the human-readable JSON direction:hash list, encoding refuses any step that is not a well-formed direction plus 64-lowercase-hex digest rather than emitting bytes the decoder would reject, decoding rejects any depth above 64 steps, and the empty proof encodes to the single byte 0x00 (the string "AA" in base64url). The full byte layout is specified in the compact Merkle proof encoding, and the bundle fields that carry it are defined in the proof bundle wire format.