Skip to content

The hash chain

A bank needs to know that the events in a pack are all the events, and that none was changed. HalvorAI links events into a hash chain to make that checkable.

For each organization and environment, events are numbered in the order HalvorAI accepts them. Each event stores:

  • chain_seq: its position, starting at 1 with no gaps.
  • canonical_sha256: the SHA-256 of the event’s canonical JSON form.
  • prev_chain_hash: the previous event’s chain_hash, or nothing for the first event.
  • chain_hash: sha256(prev_chain_hash bytes || canonical_sha256 bytes), over the raw 32-byte digests.

Change any past event and its hash changes, so every later chain_hash stops matching. Remove one and the sequence numbers skip. Either shows up when the chain is recomputed.

HalvorAI takes a lock per organization and environment while it numbers a batch, so concurrent senders still get a gapless sequence.

Once a day HalvorAI signs the latest chain_hash of each organization with its pack-signing key and stores that anchor. An anchor proves what the chain looked like at that moment. Packs include the anchors that cover their events, so a reviewer can check that nothing in the date range was removed after the fact.

The public keys that verify anchors and pack manifests are published at GET /v1/.well-known/pack-keys. Old keys stay in the set forever, so old packs keep verifying after a key rotation.

Producer signatures add a second guarantee

Section titled “Producer signatures add a second guarantee”

The chain proves HalvorAI did not alter events after receiving them. The producer signature on each event proves the event is what your source sent. Both are checked when a pack is verified.

The offline verifier recomputes every link and the anchors in a pack. You do not need an account or network access to HalvorAI beyond fetching the public key set, and you can pin the key file to avoid even that. See verify an evidence pack.

The chain proves integrity from the moment of ingest. It cannot prove that your agent reported every payment it made. That is what attribution and verification coverage measure.