Home / Features

SHA-256 hash chain write path for decision records

This is the write path: every decision record posted to Auditrek gets a sequence number and a prev_hash taken from the last record for that AI system, and a hash computed as sha256(prev_hash + payload). All of it is stored in one transaction, and the API returns 201 with the created record so you hold the hash and sequence number on your side too.

Auditrek is not open yet, so anything on this page about what it does is what it is being built to do.

Auditrek: SHA-256 hash chain write path for decision records

An append-only table is not a tamper-evident record

Most teams already log inference events. The log is a table, it has a created_at column, and by convention nobody updates rows. That convention is the whole of the integrity story, and it is the part an examiner will not take on trust.

The problem is not malice, it is that nothing in a plain table distinguishes a row written in March from a row written in March and quietly corrected in September. Anyone with write credentials to the database, including a migration script, a backfill job or a well-meaning engineer repairing a null, can change a stored output or a confidence score and leave no residue. When you are asked to evidence what a model decided, when it decided it, and whether a human overrode it, the honest answer from a conventional log is that the values are what the database currently says they are.

A hash chain removes the question of trust from the answer. Each record commits to the one before it by hashing its predecessor's hash together with its own payload, so a single altered field changes that record's hash, which no longer matches the prev_hash carried by the next record, and the break is detectable by recomputation rather than by inspection. This page describes exactly how Auditrek performs that write.

How the write path works

  1. An inference event is posted to the decisions API

    Decision records arrive over a generic REST or webhook call carrying the inference event payload: input hash, model id and version, output, confidence, timestamp and the human override flag. The call happens after your model has already returned its result, so nothing in this path sits inside your production inference call.

  2. Sequence number and prev_hash are resolved from the last record

    The write path reads the most recent record for that ai_system, sets sequence_number to its successor, and takes prev_hash from that record's stored hash. Chains are kept per AI system, so a credit model and a triage model do not share a sequence space.

  3. The record hash is computed as sha256(prev_hash + payload)

    SHA-256 over the predecessor's hash concatenated with the canonical payload of this record. Change any covered field after the fact and the recomputed hash no longer matches what is stored, and the link to the next record no longer holds.

  4. Every field is stored atomically in one transaction

    Payload, sequence_number, prev_hash and hash are committed together. There is no window in which a record exists without its link, or a link exists pointing at a record that failed to write.

  5. The API returns 201 with the created record

    The response includes the hash and the sequence number, so the calling system can retain its own copy of the receipt and compare it later against what the ledger holds.

  6. The linkage is covered by a test, not just by design intent

    The write path ships with a test that seeds a chain of records for one AI system and asserts that each record's prev_hash matches the hash of the record before it.

What each element of the write does

ElementHow it is derivedWhat it gives you
sequence_numberSuccessor of the last record's sequence number for that ai_systemPosition in a single per-system ordering, so gaps and reordering are visible
prev_hashThe stored hash of the immediately preceding record in that system's chainEach record commits to its predecessor rather than standing alone
hashsha256(prev_hash + payload)A fixed-length commitment to both this record's content and the whole history before it
WriteOne database transaction covering all fieldsNo partially linked records, even under a failed or retried write
Response201 with the created record, including hash and sequence_numberA receipt the calling system can store and reconcile independently

What this changes for the person who has to evidence it

Detection is recomputation, not judgement

A tampered record is not something you have to notice. Recomputing sha256(prev_hash + payload) along the chain either reproduces the stored hashes or it does not, and a mismatch names the first sequence number where the chain broke.

Chains are scoped per AI system

Each connected ai_system carries its own sequence and its own chain, so a break is located to one system and one sequence number rather than casting doubt across every model you run.

Nothing is added to the inference path

The write is an ordinary HTTP POST or webhook delivery made after the model has responded. There is no model migration, no SDK inside the serving process and no new dependency between your inference latency and this ledger.

The caller holds its own receipt

Because the 201 response carries the hash and sequence number, the system that made the decision can retain the commitment it was issued, rather than relying solely on what the ledger later reports about itself.

Integrity is asserted by structure, not by policy

You are not asking an examiner to accept that your team does not edit rows. You are showing a construction in which editing a covered field produces an arithmetic contradiction with every record that follows.

Where the write path sits in the rest of the ledger

The write is one stage in a path with gates on either side of it, and those gates exist because of what these payloads contain.

Before the write

An AI system cannot be connected at all until a DPA confirmation with a signed_at value is recorded: no API key and no webhook secret are issued before that, and the check is enforced server side rather than in the interface. At ingestion, a data-minimisation gate inspects incoming payloads for recognisable raw sensitive-field patterns and rejects them with a 422 before any database write, and subject identifiers are pseudonymised by default. Records that should never have entered the ledger are better refused than chained.

After the write

Verification is a server-side endpoint that walks the chain for that record's AI system from the first sequence to the record in question, recomputes each hash from the stored prev_hash and payload, and returns a tamper status of valid or broken with the first broken sequence number. It reports what recomputation found, not a flag that was stored earlier and could itself have been edited. Report output for a chosen system and date range is generated as PDF and HTML mapped to EU AI Act Article 12 and 13 fields, and every report carries an embedded disclaimer stating that it does not constitute legal advice and has not been reviewed by qualified regulatory counsel.

Auditrek is in build and not yet open for connections. This page describes the write path as it is being implemented, so that when you evaluate it you are evaluating a mechanism rather than a promise.

Questions

What exactly is hashed for each decision record?

The record hash is sha256 of the previous record's hash concatenated with the canonical payload of the current record. The canonical payload covers the decision content fields carried on the record, including the sequence number, input hash, output, confidence, human override flag and the pseudonymised subject reference. The stored created_at timestamp is not inside the hashed payload in this write path.

What happens to the chain if two events for the same system arrive at once?

Sequence number, prev_hash, hash and payload are written for a given ai_system inside a single transaction, so a record and its link to the predecessor commit together or not at all. There is no state in which a record exists without a resolved prev_hash.

Does this require changes to my model serving code?

No model migration is involved. Decision records are posted over a generic REST or webhook call after the model has returned its result, with documented payload mapping guides for AWS SageMaker and Azure ML rather than bespoke platform SDKs.

How would I detect that a record had been altered?

Through the server-side verification endpoint, which walks the chain for that record's AI system from the first sequence up to the record, recomputes each hash from the stored prev_hash and payload, and returns a tamper status of valid or broken along with the first broken sequence number.

Is there one chain for my whole organisation?

No. Records are chained per ai_system, so each connected system has its own append-only sequence and its own chain of hashes.

Can I send raw applicant, patient or credit bureau fields in the payload?

The ingestion API is built to reject them. Payloads containing recognisable raw sensitive-field patterns are refused with a 422 and an error body before any database write, and subject identifiers are pseudonymised by default. A signed DPA confirmation is also required before any API key or webhook secret is issued for a system.

Does a valid tamper status mean my records satisfy a regulator?

No, and Auditrek does not represent it that way. A valid status means recomputation reproduced the stored chain for that system up to that record. Reports are designed to support documentation of EU AI Act Article 12 and 13 fields and carry an embedded disclaimer that they are not legal advice and have not been reviewed by qualified regulatory counsel. Whether your documentation meets an obligation is a judgement for your own counsel.

Join the waitlist

Leave your work email and we will send the payload schema, the verification endpoint documentation and a sample Article 12 and 13 report before you talk to anyone. Pilot cohort conversations start with your own pipeline, not a demo script.

One email when it launches, and one now to confirm your address. Unsubscribe any time. Privacy.