Repository navigation
The Verifier
kingres-verify is a standalone command-line verifier for the ledger (see Ledger). It checks digests, inclusion proofs, exported block headers, signed checkpoints, tile logs, aggregate digests, bundles, client signatures and anchors without trusting the database. An auditor runs it on their own machine with files obtained earlier. It is an independent second implementation of hash format version 1, written from the documentation, and it is checked against fixtures from a real server. It has a reproducible build and a release script that produces signed checksums.
It uses the Go standard library only (no third-party modules), so that an auditor can read all of it and build it with one command.
cd kingres/verifier
go build -o kingres-verify ./cmd/kingres-verify
Go 1.27.3 or later. go test ./... needs no database.
An auditor must not run a verifier that came from the cluster it checks. Two ways give one that does not depend on the operator, and both end in the same check.
-
From the source, at the release tag (preferred). Clone the repository on your own machine, check out the tag, and build with
scripts/build-one.sh <GOOS> <GOARCH> <VERSION> <OUTPUT>, which holds all the flags (CGO_ENABLED=0,-trimpath, no build id, fixed micro-architecture levels, no other Go release fetched). There is no third-party module, so the build depends on the Go release only, and the same source and Go release give the same bytes on any machine. Comparesha256sumof the result with the line ofSHA256SUMS.scripts/repro-check.shbuilds twice in different places and requires the same bytes. -
From the release files. A release is the binaries (
kingres-verify-linux-amd64,-linux-arm64,-darwin-arm64,-windows-amd64.exe),SHA256SUMS,RELEASE(the version, the commit, its date and the Go release) andSHA256SUMS.note, a signed note overSHA256SUMSmade with the release key below. They are made byscripts/release.shfrom a clean checkout whoseHEADis exactly the tag. The first release, 0.1.0, was published on 2026-11-28, and its verifier files are attached to the GitHub release kingres-0.1.0-pg18 (the verifier is cut with--tag kingres-<version>-pg18, so the release ofkingres-0.1.0-pg19does not carry them). On the release page the sums and the note are namedkingres-verify-SHA256SUMSandkingres-verify-SHA256SUMS.note, because a release page has one name for each file and the product's ownSHA256SUMSis there too; give them to--sumsand--noteunder those names. In the next release of the verifier,scripts/release.shwrites them under those names itself, and the sums of the product's packages and images (kingres-SHA256SUMSwithkingres-SHA256SUMS.note) are signed with the same key and checked with the same command (Installing and Packaging). The command streams each file and refuses one over 1 GiB. The verifier was not released again with 0.1.1: its files stay on the release page ofkingres-0.1.0-pg18. The product checksums of 0.1.1 (kingres-SHA256SUMSandkingres-SHA256SUMS.note) are checked withkingres-verify release verify, but with a verifier built fromkingres-18after 2026-11-28: the verifier of 0.1.0 refuses file names with a+and files over 256 MiB, so it cannot check the packages and images. Check the files before you run anything, with a verifier you already trust (a build of your own, or one from an earlier release), and with the key from this page or the repository README, not from the place you downloaded the files from. The commandkingres-verify release verifyis shown in the next section. It printsVERIFIEDonly when the note is signed by that key, its text is the sums file, and every binary has the SHA-256 of its line. It cannot show that a release is the newest one: compare the version with the project's announcement. The Debian package also installs a copy ofkingres-verifyas a convenience; that copy is not an independent verifier.
The release files of kingres-verify (the binaries, RELEASE and SHA256SUMS) are signed: SHA256SUMS.note is a signed note over SHA256SUMS, made with the project's release key. The key is Ed25519, key name kingres-verify-release, held by the project owner:
public key: bbwi8vQotQ8amSyMOM70mk1Q+JSSD2gmbBDxnYiTma0=
key string: kingres-verify-release+dc5771ec+AW28IvL0KLUPGpksjDjO9JpNUPiUkg9oJmwQ8Z2Ik5mt
fingerprint: 81ac03cf18cf327bcdb757473e71851ec1d8c19eb6d6a8f33a08cb2574bcffd5
Check the files before you run anything, with a verifier you already trust (a build of your own, or one from an earlier release):
kingres-verify release verify --sums SHA256SUMS --note SHA256SUMS.note \
--key kingres-verify-release+dc5771ec+AW28IvL0KLUPGpksjDjO9JpNUPiUkg9oJmwQ8Z2Ik5mt \
--binary kingres-verify-linux-amd64
The line you want is VERIFIED. The same values are printed in kingres/verifier/README.md ("The release key"); do not trust a key that is not in both places. The key has no expiry date; if it is ever replaced, the new key is announced on this page and in the README before a release is signed with it.
It verifies what is in the files you give it, nothing else.
- The digest must be obtained and kept outside the control of the database. A digest read from the database you are checking proves nothing.
- A proof shows that an entry with a given
row_hashandtable_idis in the ledger. To learn that a row you hold is in the ledger, recompute its row hash from your own data (row-hash) and give it toproof --row-hashwith--table-id. - It does not prove that a row was not changed later in the table, that no other rows exist, or anything about transactions not yet in a block covered by a digest.
- Block times are the server's clock; they are evidence only against an external anchor.
-
checkpointwithout--stateshows that a checkpoint is signed by a key you trust, not that it is the latest one.
psql -X -At -c "SELECT kingres.ledger_generate_digest()" > digest.json
psql -X -At -c "SELECT kingres.ledger_inclusion_proof('app.accounts', kingres.ledger_row_hash(a.*)) FROM app.accounts a WHERE id = 1" > proof.json
Store the digest where the operators of the database cannot change it.
| Command | Purpose |
|---|---|
proof |
verify an inclusion proof against a trusted digest: kingres-verify proof --proof proof.json --digest digest.json [--table-id N] [--row-hash HEX] [--op I|D|any]
|
row-hash |
compute the row hash from your own data: kingres-verify row-hash --table-id N --columns columns.json
|
digest-chain |
check that several digests of one chain are mutually consistent |
blocks |
recompute the hashes of an export of block headers: blocks --blocks blocks.jsonl (--digest digest.json | --chain-id HEX)
|
trust init, trust show, trust follow
|
make, inspect and follow the trust file |
checkpoint |
verify one signed checkpoint of a chain or aggregate log; with --state it also proves from tiles that it extends the one you recorded |
consistency |
check a consistency proof between two checkpoints |
aggregate |
verify an aggregate digest |
proof --bundle, bundle verify, bundle fetch
|
verify or download a bundle of a publication |
monitor |
poll a publication, keep the last checkpoint seen and detect a rollback or fork |
attestation |
verify a client signature on a row against a digest or bundle |
anchors |
verify the anchors of an aggregate checkpoint (WORM, RFC 3161, OpenTimestamps) |
release verify |
check SHA256SUMS.note and the binaries of a verifier release against the release key |
version, --help
|
version and usage |
A publication source (--source) can be a directory, a .tar.gz file or an https:// address (plain http:// only for loopback). Example from the README:
kingres-verify checkpoint --trust trust.json --log chain:<id>[:e<N>]|aggregate:<id> [--source DIR | --note FILE] [--state FILE]
Proofs are for one entry with the operation I (inserted) or D (removed). --op I or --op D makes the expected operation your explicit choice.
- On the server, export a digest and keep it outside the database:
psql -X -At -c "SELECT kingres.ledger_generate_digest()" > digest.json. - From your own copy of the row, build
columns.json: one object per non-NULL column in column order, withnameandsend_hex(the hex of the type's binary send form; for exampleencode(int4send(id), 'hex')afterSET client_encoding = 'UTF8'). The table id isSELECT table_id FROM kingres.ledger_table WHERE relid = 'app.accounts'::regclass. -
kingres-verify row-hash --table-id N --columns columns.jsonprints the row hash (64 hex characters). - Later, export a proof from the server (
kingres.ledger_inclusion_proof(...), see above) and runkingres-verify proof --proof proof.json --digest digest.json --table-id N --row-hash HEX --op I. A digest of the same block as the proof or later is needed; an older digest fails at the stepchain-walk.
Exit status 0 and the word VERIFIED mean the entry is in the chain the digest commits to. The commands that read a publication or a bundle (checkpoint, consistency, aggregate, anchors, bundle verify, bundle fetch, monitor, attestation, trust follow) can also end with status 3, and only checkpoint --state can end with status 4.
| Status | Meaning |
|---|---|
| 0 | everything that was asked for was verified |
| 1 | a verification failed, or a file has a form it must not have |
| 2 | usage or input error, or the result could not be written |
| 3 | incomplete: nothing failed, but something that was asked for could not be checked with the inputs and flags given (the publication does not contain it, or the source cannot be reached). Treat it as an alert, never as "probably fine": a publisher that hides a fork can withhold the tile that would show it. |
| 4 | a fork or rollback was found and the conflicting checkpoint could not be saved (only checkpoint --state) |
| 5 | only release verify: the signature and the hashes are genuine but the set was made by a dry run (a signed build that is not a release); --accept-dry-run gives 0 |
--json prints one JSON object instead of text, with the same status. Text from the inputs is escaped so that no input can forge a line of output. A standard output that is a closed descriptor is refused with status 2, so that a lost verdict is not taken for a success; a caller that gives the null device on purpose says so with KINGRES_VERIFY_NO_OUTPUT=1.
- It trusts only the trust file that you made from a key you obtained outside the cluster. A key that is revoked or outside its validity window is not used for new checkpoints.
max_tree_sizeretires a key at a known size. - With
--state FILEit keeps the last verified checkpoint so that a rollback or fork is found. The file holds only what was verified, the whole path of its directory must be private, and a lock stops two runs from writing at once. - Key events from the publication are verified under your trust file before they narrow it. A key revoked by a verified event vouches for nothing.
- Anchors: the evidence file is the cluster's claim and nothing in it is believed. Each kind is checked from your inputs (
--worm-url, thetsa_rootsof your trust file,--btc-header HEIGHT:HEX). Without that input the result is status 3.
The verifier is built (phase 7): digests, inclusion proofs, block headers, signed checkpoints and consistency proofs, tile logs, aggregates, bundles, client signatures, anchors, a monitor, the trust file with key events, and the release check. Its source is the standard library only, its build is reproducible, and the release files are signed with the release key above; the release 0.1.0 (2026-11-28) carries them. The RFC 3161 and OpenTimestamps checks of the verifier work from inputs that the auditor supplies, and the anchoring they check was tested against local fakes only (Ledger Anchoring). The custody of the release signing key is the project owner's decision. See Status and Roadmap and Ledger Signing and Publication.
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/verifier/README.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/contrib/kingres_ledger/README.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/docs/design/ledger-phase7.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/reviews/2026-11-19-kingres-verifier-publication-and-client-signatures.md
- https://github.com/KingresDB/Kingres/blob/kingres-18/kingres/docs/reviews/2026-11-18-kingres-verifier-seventh-fixes.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