Skip to main content

Module chain

Module chain 

Source
Expand description

Per-broker audit hash-chain primitives.

The chain binds each record to all prior records: new_head = SHA256(prev_head ‖ seq_be ‖ value). The writer stamps (seq, prev_head) on each record. The verifier recomputes the chain and checks continuity. The writer and the verifier must use these functions. Never reimplement the formula.

Structs§

ChainLink
The chain position a record is stamped with.
ChainState
Running per-broker chain state.

Constants§

GENESIS_HEAD
Chain head before the writer writes the first record.

Functions§

chain_hash
Canonical chain hash. new_head = SHA256(prev ‖ seq.to_be_bytes() ‖ value).
from_hex32
Parse exactly 32 bytes of lowercase or uppercase hex.
to_hex
Encode bytes as lowercase hex.