Repository navigation
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.
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.
| 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.
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.
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.
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.
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.startLedgerVerificationwith"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-reportsandcheck-report; the console shows the reports). -
Three results.
ok,failedorincomplete. 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.failedmeans 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 isaltered. 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-setandaudit-now; "Scheduled audit" on the Publication tab of the console. -
Three alerts.
ledgerPublicationAltered(critical),ledgerPublicationBehind(warning) andledgerPublicationUnreadable(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 anchorsrun 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.
- In release 0.2.0 the check
anchorsof 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 ownanchorscommand 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 stayssubmitted. - 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.
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/docs/design/ledger-phase7.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/control-plane/README.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/verifier/README.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/api/openapi.yaml
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/README.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/docs/guide/operator-guide.md (section 8)
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/docs/guide/limitations.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/docs/reviews/2026-11-20-kingresd-anchoring-wiring-and-publication-fixes.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/docs/reviews/2026-11-18-kingresd-anchoring-libraries-fifth.md
KingresDB's own code is licensed under AGPL-3.0-only. PostgreSQL code keeps the PostgreSQL License. Copyright of the project's own code: RooyeKhat Media Co. KingresDB is derived from PostgreSQL and is not endorsed by the PostgreSQL project. Repository | Licence | COPYRIGHT
KingresDB
1. Product
- Product Overview and Features
- Status and Roadmap
- User Guide
- Administrator Guide
- REST API Reference
- Web Console
- Command Line Client
- Extensions
- Limitations and Known Issues
- Release Notes
Features in detail
- Sharding
- Sharding Query Pushdown
- Sharding Table Lifecycle
- High Availability
- Ledger
- Ledger Signing and Publication
- Ledger Anchoring
- The Verifier
- Analytics Extensions
Administration
- Cluster Setup
- Servers Databases and Roles
- Rebalancing
- Configuration
- Memory and Warm-up
- Control Plane and REST API
- Upgrades
2. Architecture (arc42)
- Architecture
- Architecture Introduction and Goals
- Architecture Constraints
- Architecture System Context
- Architecture Containers
- Architecture Components
- Architecture Runtime Views Sharding
- Architecture Runtime Views Availability and Ledger
- Architecture Deployment
- Architecture Crosscutting Concepts
- Security Model
- Architecture Decisions
- Architecture Quality Requirements
- Architecture Risks and Technical Debt
- Enterprise Architecture
3. Data architecture
- Data Architecture
- Data Model Sharding
- Data Model Ledger
- Data Model System Database
- Data Model Analytics
- Data Lifecycle
- Backup Restore and PITR
- Data Security
- Data Quality and Integrity
4. Development
- Building from Source
- Development and Testing
- Repository Layout
- Coding Standards
- Branching and Synchronisation
- Testing Strategy
- Review Process
- Release Process
- Contributing
5. Operations