Purpose. Verify tamper-evident ordering by recomputing the append-only chain across a local ledger. Result flag: CHAIN_OK.
When you can check it.
- With a ledger: rewalk the chain (preferred).
- Without a ledger: you can only shape-check
chain(64-hex); setCHAIN_OK=na.
Definitions (ASCII, recap)
stamp_core_k = "SSMCLOCK1|" + iso_utc + "|" + rasi_idx + "|" + theta_deg + "|" + h_filechain_0 = "0"*64chain_k = H_chain_k( ascii(chain_{k-1} + "|" + stamp_core_k) )
whereH_chain_kiskv:chain_algoon that row (defaultsha256).
Ledger rewalk (verifier procedure)
- Init:
tip = chain_0. - Scan rows in recorded order. For each row
k:- Rebuild
stamp_core_kfrom the row (exact ASCII). - Let
H_chain_k = kv:chain_algoelsesha256. - Compute
calc = H_chain_k( ascii(tip + "|" + stamp_core_k) ). - Require:
calc == row.chain(string equal, lowercase 64-hex). - Set
tip = calc.
- Rebuild
- Membership check (optional): if you are validating a particular file’s sidecar, require a row for that file with an exact
chainmatch. - Pass/fail: first mismatch → FAIL (break position =
k). If the scan completes cleanly, setCHAIN_OK=true.
Isolated stamp (no ledger available)
- Validate shape:
chain ∈ [0-9a-f]{64}and all other checks (file/clock) pass. - Set
CHAIN_OK=na. You can verify ordering later when a ledger is available.
Why this proves ordering
- Each
chain_kcommits to everything before it viachain_{k-1}. - Any deletion, insertion, or reordering changes all subsequent
chain_k, exposing tampering immediately.
Acceptance rules (must)
- Rewalk uses the declared
kv:chain_algoper row. - All hash inputs are the exact ASCII bytes of the shown concatenations (literal
|, no spaces, no Unicode punctuation). chainfields are lowercase 64-hex.
Common pitfalls
- Using a single algorithm for all rows when some declare a different
kv:chain_algo. - Adding spaces or using non-ASCII separators inside hashed strings.
- Uppercase hex in
chain. - Rebuilding
stamp_core_kwith a differently formattedtheta_deg(must match the recorded fixed-digits string).
Outcome
CHAIN_OK=trueif the rewalk completes and (optionally) the target file’s row is present.CHAIN_OK=falsewith the first failing row index and a brief reason, e.g.,mismatch at k=127.CHAIN_OK=naif no ledger is provided.
Navigation
Back: SSM-Clock Stamp – Clock Consistency (2.3)
Next: SSM-Clock Stamp – Anchor Verification (2.5)