Skip to main content

Module blockchain

Module blockchain 

Source
Expand description

Blockchain collection kind — pure logic.

A KIND blockchain collection stores append-only rows whose hash field depends on the previous row’s hash, forming a tamper-evident chain. Issue #521 lands the engine integration in a later iteration; this module ships the deterministic primitives (hash, verify_chain, error types) so the later wiring is a thin storage adapter on top of audited logic.

Structs§

Block
A materialized block as stored. hash MUST equal compute_block_hash(...) over the other fields — verify_chain enforces this.
ChainTip
Engine response to GET /collections/:name/chain-tip.
SignedFields
Optional signer fields included in the hash preimage when the collection has SIGNED_BY (...) declared. Issue #520 supplies the signer registry; the chain hash binds the signature so a replaced signature also breaks the chain.

Enums§

BlockchainError
Operational errors surfaced by the blockchain engine path.
VerifyReport
Result of walking a chain end-to-end. Inconsistent reports the FIRST block whose stored fields disagree with a recomputed hash; the chain is not walked past the first failure.

Constants§

GENESIS_PREV_HASH
All-zero hash used as prev_hash for the genesis block.

Functions§

compute_block_hash
Canonical hash preimage:
verify_chain
Walk blocks in order. Returns the first inconsistency or Ok if every block’s stored hash matches the recomputed hash AND links the previous block.