Skip to content

Ledger Anchoring

Mohammad Rasoul Kazemi edited this page Dec 1, 2026 · 4 revisions

Ledger Anchoring

What is built, and what is not. Anchoring is built: a WORM object store, an RFC 3161 time-stamp authority and OpenTimestamps, with write-only credentials, alerts and evidence download. The RFC 3161 and OpenTimestamps paths were tested against local fakes only, never against a real authority, calendar or Bitcoin node. In release 0.2.0 the check anchors of a ledger verification (startLedgerVerification, which answers 422 unsupported_operation) and a scheduled audit of the publication are not built. They are built in release 0.2.1 (phase 18, task 1); see "The check anchors and the scheduled audit" below.

What anchoring is

An anchor is evidence that the digest of an aggregate checkpoint existed at a time that an outside party vouches for. What is anchored is the aggregate checkpoint of a database (see Ledger Signing and Publication). It commits to every chain of the database and to every earlier round, so one anchor covers everything before it. TSA and OpenTimestamps receive the SHA-256 of the checkpoint text. A WORM target stores the full signed note. Anchoring runs every anchor.intervalSeconds for each database whose latest aggregate checkpoint is newer than the last anchored one, and on demand (anchorLedgerNow). Only the latest checkpoint is anchored.

Anchoring shortens the window in which an attacker could rewrite history unnoticed. It does not make the cluster tamper-proof.

Target kinds

Kind What it is Notes from the documents
worm an S3-compatible object store with Object Lock credentials are write-only (accessKeyId, secretAccessKey, optional sessionToken) and are never returned; a target may instead name credentialsPath
tsa an RFC 3161 time-stamp authority needs a caBundlePath against which the token is checked; tested against local fakes only
ots OpenTimestamps (calendars and Bitcoin headers) tested against local fakes only; without a headerSource a calendar's answer is only a claim, shown as submitted and never counted as anchored

Each credentials file carries a rotation generation: the leader gives a file to a holder with a lower generation and takes the file of a holder with a higher one first, and a server refuses to write a lower generation over a higher one (409 older_generation). When two holders have different files of the same generation, the alert ledgerAnchorFailed asks you to enter the credentials again, which makes a higher generation. A pass has one worker for each target, so a target that hangs does not hold up the others, and a bounded number of records per target is taken in a pass, so a hundred OpenTimestamps records waiting for a block header do not stop the rest.

Targets are managed through the REST operations listLedgerAnchorTargets, createLedgerAnchorTarget, getLedgerAnchorTarget, updateLedgerAnchorTarget, deleteLedgerAnchorTarget and testLedgerAnchorTarget. Records are managed with listLedgerAnchors, retryLedgerAnchor and downloadLedgerAnchor (formats json, tsr, ots). Outgoing requests go to the configured host and port only, follow no redirect and use no proxy.

What "anchored" means

A record is anchored only when the library of its kind returned a receipt whose evidence its own parser reads back. The time means different things per kind:

  • WORM: the store's Last-Modified, the store's word.
  • TSA: the token's genTime, the authority's word, within its accuracy.
  • OpenTimestamps: "no later than" the miner's time of the Bitcoin header, an error of the order of hours.

None says that the checkpoint is the latest or that no other history was anchored.

Alerts

ledgerNotAnchored (info, or warning when anchor.required), ledgerAnchorBehind, ledgerAnchorFailed and ledgerAnchorConflict. The scheduled audit of the publication (below, since 0.2.1) adds ledgerPublicationAltered, ledgerPublicationBehind and ledgerPublicationUnreadable. An operator should keep at least one anchor in a different administrative domain, and run a monitor (kingres-verify monitor) so that a rollback is seen even if every target is silent.

Verification by an auditor

The standalone verifier re-checks anchors from the auditor's own inputs (kingres-verify anchors): a time-stamp token against the certificates the auditor pinned, an OpenTimestamps proof against a Bitcoin header the auditor supplies, and a WORM object that the auditor fetches again. Without those inputs the result is status 3 (could not check), never success. See The Verifier.

The check anchors and the scheduled audit (since 0.2.1)

This section describes work that is in release 0.2.1 and is not in release 0.2.0. It is phase 18, task 1 (ADR 0059, REST contract 0.36.0). In 0.2.0 the check answers 422 unsupported_operation and there is no scheduled audit.

  • The check anchors. startLedgerVerification with "checks": ["anchors"] (kingres-cli ledger verify --checks anchors) verifies on the server every anchor record of the database (the newest 200 per run): it recomputes the digest from the stored checkpoint and compares it with the record and with the publication; reads a WORM version back from the store; verifies an RFC 3161 token against the roots of its target; and recomputes an OpenTimestamps proof from the digest and checks it against a Bitcoin block header that the evidence carries. The result is stored as a report with its evidence (listLedgerCheckReports, getLedgerCheckReport; kingres-cli ledger check-reports and check-report; the console shows the reports).
  • Three results. ok, failed or incomplete. Incomplete is never shown as ok: a store that cannot be reached, no CA bundle, no Bitcoin header, an anchor that is not final, a checkpoint thinned out of the publication, or no anchor target at all. failed means that evidence and publication differ (a changed object, a token that does not verify, a checkpoint that an anchor names and the publication no longer holds).
  • The scheduled audit of the publication. A job on the manager leader (every 24 hours by default, 5 minutes to 7 days; on demand with runLedgerPublicationAudit, also when the schedule is off) re-reads every log from block 0, compares every block of the database with the published leaf, and keeps for each log the largest checkpoint that it verified (the high-water mark, which begins at the first audit). A log that is emptied, shrunk, rolled back or given another root at a verified size is altered. The work is done in passes of bounded work whose state is in the system database, so it survives a change of the leader. Settings and state: getLedgerPublicationAudit, updateLedgerPublicationAudit; kingres-cli ledger audit, audit-set and audit-now; "Scheduled audit" on the Publication tab of the console.
  • Three alerts. ledgerPublicationAltered (critical), ledgerPublicationBehind (warning) and ledgerPublicationUnreadable (warning, critical after three audits). See Monitoring and Alerts.
  • Acknowledging. An altered finding is sticky: it and its critical alert stay, whatever a later audit finds, until an administrator acknowledges it with acknowledgeLedgerPublicationAlteration (kingres-cli ledger audit-ack; per log with --shard-group, or for every log with a finding). The acknowledgement is audited, recorded (who, when, why) and takes the publication as it is then for the new baseline.
  • This is the server looking at its own evidence. It is not the independent check. A superuser who controls the cluster, its key files and the system database can change the publication, the key set and the audit together. The independent check is kingres-verify anchors run by an auditor with a trust file of their own (The Verifier). Every report carries a list of what it does not prove, and Limitations and Known Issues gives it. Runs against real authorities are phase 18, task 2, and are not done.

Not built, and not proven

  • In release 0.2.0 the check anchors of a ledger verification and a scheduled audit of the publication are not built; in release 0.2.1, they are, as the server's own look at its evidence and not as the independent check. The verifier's own anchors command is built and checks evidence from the auditor's inputs.
  • RFC 3161 and OpenTimestamps were tested against local fakes only (the runs against real authorities are phase 18, task 2: not done). The "anchored" outcome of OpenTimestamps through the Bitcoin header source could not be shown through the wiring without a library change; the claim path is tested up to claimed, and a calendar's answer without a header source stays submitted.
  • Not in the first release: the anchor probe from another server (phase 7 step 24).
  • After a restore of the system database the way back to signing is an operator's decision and forks the logs against a mirror (Ledger Signing and Publication).

The Ledger page of the console has an anchoring tab (targets, their test, the records and the evidence); see Web Console.

Sources

Clone this wiki locally