Knowledge Base

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

Byte-Prefix Registry

The complete lookup table of every single-byte SHA-256 domain-separation prefix Truestamp uses, the thirteen kinds of SPEC.md 4.3, mapping each byte to what it hashes and whether it is signed, so a verifier can reproduce any hash exactly.

Overview

Truestamp hashes with SHA-256 and puts a single distinguishing byte in front of the input before hashing, so that each kind of object lives in its own private hash space. This page is the authoritative enumeration of every prefix Truestamp uses: the exact byte value, what it hashes, and whether the result is signed. It is a lookup reference, not an explainer. For why domain separation is done at all, see domain-separated hashing. A verifier reproducing any Truestamp hash needs the prefix from this table, because the preimage is always prefix_byte || data.

Every prefix is a single byte written here in hexadecimal (0x31) with its decimal equivalent alongside. The high nibble names the family, in the order Truestamp processes its records: items and entropy as the leaves, then blocks, epochs, proofs, and keys last.

The kind map

The thirteen kinds below are the registry of the proof format, as SPEC.md section 4.3 of the Truestamp verification specification and its spec/prefixes.json fix them. A kind that hashes a record hashes the JSON Canonicalization Scheme (JCS) encoding of a JSON object R: H(p, R) = SHA-256(p || JCS(R)). A kind that hashes raw bytes hashes fixed-width bytes directly.

Prefix Decimal Family Construction Hashes Signed
0x00 0 Merkle leaf a leaf’s 32 bytes no
0x01 1 Merkle node two child hashes, left then right no
0x10 16 Items claims_hash the JCS of the item’s claims no
0x11 17 Items item_hash the JCS of the item record {claims_hash, id, witness_hashes} no
0x20 32 Entropy entropy_hash the JCS of the entropy object: {payload, source} for NIST, {network, payload, source} for Stellar and Bitcoin no
0x21 33 Entropy observation_hash the JCS of the observation record {entropy_hash, id} no
0x30 48 Blocks genesis previous_block_hash the JCS of the GENESIS object no
0x31 49 Blocks block_hash the JCS of the seven-member block record yes, by the key the chain assigns
0x40 64 Epochs epoch_hash the JCS of the epoch record {leaf_count, merkle_root} no
0x50 80 Proofs proof_hash the JCS of the proof yes, by the active key
0x60 96 Keys key_id a public key’s 32 bytes, cut to the first 4 bytes of the digest no
0x61 97 Keys prerotation_commitment the next public key’s 32 bytes no
0x62 98 Keys handover the JCS of the rotation event without its handover signature yes, by the outgoing key

Each byte is used once, and every other byte is unassigned. A byte never moves: a new kind takes its family’s lowest free low nibble, and a new family the lowest free high nibble, 0x7_ next. A proof never carries a prefix as data, and a verifier takes every byte from its own compiled table, never from a document. Exactly three kinds are signed: a block record (by the key a rotation block introduces, and by the active key otherwise), the proof (by the active key) and a handover (by the outgoing key). Nothing else Truestamp stores or publishes carries a signature: items, entropy observations, commitments and epochs are not signed. Each signature is pure Ed25519 over the 32 bytes of the record hash, never over the record’s bytes; see Ed25519 signatures.

Where each kind is used

  • An item stores its claims_hash (0x10) over its stored claims, exactly as stored, and its item_hash (0x11) over its item record. The item_hash is the item’s Merkle leaf.
  • An entropy observation stores its entropy_hash (0x20) and its observation_hash (0x21). The observation_hash is the observation’s Merkle leaf.
  • Every block stores its block_hash (0x31) over its block record {height, id, leaf_count, merkle_root, metadata, previous_block_hash, signing_key_id}. The genesis block’s previous_block_hash is the 0x30 hash of its GENESIS object, which names a Bitcoin block header.
  • An epoch’s epoch_hash (0x40) is the value written to a public chain: the hash memo of a Stellar transaction, or the 32 bytes of a Bitcoin transaction’s OP_RETURN output. Its record holds the epoch tree’s merkle_root and leaf_count, so the chain commits the tree’s size with its root. Every commitment entry in a proof carries that record.
  • A proof’s proof_hash (0x50), over the JCS of the envelope’s proof member, is what the proof’s signature signs. It is computed by the verifier and never carried.
  • Every key id is the first 4 bytes of SHA-256(0x60 || public_key), and every prerotation commitment is SHA-256(0x61 || next_public_key).

Witness hashes reuse existing prefixes

An item record names its witnesses by hash in witness_hashes, and no witness type introduces a prefix of its own. The head-block witness is that block’s block_hash (0x31), and each entropy witness is that observation’s entropy_hash (0x20). A verifier recomputing a witness hash therefore reaches for a prefix already in the table, and adding a new witness type does not add a row here.

Merkle prefixes are a distinct layer

The Merkle prefixes 0x00 and 0x01 operate at a different layer from the others. They separate the two node types inside a Merkle tree, leaf versus internal node: a leaf is SHA-256(0x00 || leaf_hash) and an internal node is SHA-256(0x01 || left || right), the rule of RFC 9162 section 2.1. The leaf hashes fed into a tree are themselves already domain-separated: in a block’s tree, an item’s item_hash under 0x11 and an entropy observation’s observation_hash under 0x21; in an epoch’s tree, each block’s block_hash under 0x31. So a value can be hashed under one prefix and, at the next layer up, hashed again under a Merkle prefix.

Citations

  1. RFC 6962: Certificate Transparency. Source of the leaf (0x00) and internal-node (0x01) Merkle prefixes and the byte-prefix domain-separation approach this registry follows. Only the hashing is taken from it: the shape of Truestamp’s tree, and every prefix from 0x10 on, are Truestamp’s own.
  2. RFC 8785: JSON Canonicalization Scheme (JCS). The canonical encoding every record kind hashes.