diff --git a/LIMITATIONS.md b/LIMITATIONS.md index 50f98e8..87f4b3c 100644 --- a/LIMITATIONS.md +++ b/LIMITATIONS.md @@ -38,13 +38,16 @@ mirror protects readers only against a rewrite after it first synced, and only w compares against it. A mirror run by the operator checks almost nothing. See [MIRRORS.md](MIRRORS.md) and [docs/mirroring.md](docs/mirroring.md). -**One checkpoint has an independently operated witness receipt.** +**Two checkpoints have witness receipts; one witness has a track record.** Checkpoint 1's signing-body digest is included under a root signed by Action State's witness key. The receipt returned on September 7, 2026 (Pacific time) verifies offline against an explicit key pin, and matches the separately fetched receipt. See -[the evidence packet](docs/evidence/witness-2026-09-07/README.md). +[the evidence packet](docs/evidence/witness-2026-09-07/README.md). On October 20, 2026, a second +witness, operated by HORIZON SHIELD (which also runs a registered mirror), signed receipts for +checkpoints 1 and 2. Its key was first published that day and its log holds only those two +leaves. See [the second packet](docs/evidence/witness-2026-10-20-nenrin/README.md). -This is a one-checkpoint demonstration, not continuous or reciprocal witnessing. It does not +These are two demonstrations, not continuous or reciprocal witnessing. It does not prove registry continuity, prevent split views, cover the June entry, or prove payload retention. The JSON response reports `countersigned-observed`, but that grade is not signed inside this receipt, and this receipt signs a Merkle root without a witness timestamp: the checkpoint @@ -92,8 +95,17 @@ anywhere in the verifier: a signed `countersigned-observed` matching a reported signing a grade while its response body still reports a different one leaves the field false, correctly, because a signed value that disagrees with the untrusted one binds nothing. -The grade this registry should expect is `countersigned-observed`, and it is the honest one. -`trace-registry/v1` is enrolled with the witness as a foreign accumulator: the witness observes, +The next paragraph is about the Action State witness and its September 7 receipt. It is not a +description of the second witness. In +[the October 20 packet](docs/evidence/witness-2026-10-20-nenrin/README.md) the second witness +states that it runs both of this registry's chain checks over the files at the source commit +before it signs, and both of its receipts carry a signed `mmr-verified` equal to the grade its +response reports. That is that witness's own statement about what it did, to be read with the +limits the packet lists. It does not change what the Action State receipt carries. + +The grade this registry should expect from the Action State witness is `countersigned-observed`, +and it is the honest one. +`trace-registry/v1` is enrolled with that witness as a foreign accumulator: the witness observes, timestamps and countersigns the checkpoint bytes it is sent, and does not verify this log's own consistency proofs, so it does not check that a checkpoint extends the one before it. Consistency across checkpoints is computed by a verifier of this registry, not certified by the witness. The diff --git a/README.md b/README.md index 2e19579..ea04314 100644 --- a/README.md +++ b/README.md @@ -63,9 +63,11 @@ one implementation. A witness is an outside service that keeps its own record of a checkpoint, so the registry could not later rewrite that part of its history without the witness's copy disagreeing. Checkpoint 1 (in the 09/01 entry) has a receipt from one independently -operated witness, and anyone can verify it offline. The second checkpoint has not been -sent to a witness. One receipt shows that the witness recorded that checkpoint; it does -not show that every observer saw the same history. +operated witness, and anyone can verify it offline. Since October 20, checkpoints 1 and 2 +also have receipts from a second witness, run by a different operator with its own key +([second packet](docs/evidence/witness-2026-10-20-nenrin/README.md)); that key was first +published the same day and its log holds only those two leaves. A receipt shows that the +witness recorded that checkpoint; it does not show that every observer saw the same history.
Technical detail: what the receipt binds, and capturing another one @@ -78,7 +80,9 @@ a property of that receipt, so the verifier reports `witness_time_established` a `grade_cryptographically_bound` rather than asserting either. Both are false for this capture and stay false for it. Its protected header carries algorithm and tree profile only, and the witness signature covers that header, so a receipt carrying either field is a new receipt rather -than this one re-read. +than this one re-read. The October 20 receipts are such new receipts, from the second witness: +the one for checkpoint 2 carries a signed time and a signed grade, and the one for checkpoint 1 +carries a signed grade and no time. A further capture runs through `tools/capture_witness_receipt.py`, which submits the checkpoint, reads the receipt back by log id and by digest, and writes the response bodies, a capture manifest, the offline verification and `SHA256SUMS` into one @@ -103,7 +107,8 @@ and returns a receipt that is internally consistent with what it was given.
The pipeline does not yet submit future checkpoints automatically. Parallel independent -witnesses remain supported as a deployment choice; only one operator is demonstrated here. +witnesses remain supported as a deployment choice; two operators have each signed receipts once, +by hand, and neither runs in parallel with the other on every checkpoint. ## Why this exists diff --git a/ROADMAP.md b/ROADMAP.md index 723005a..81b06c6 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -41,15 +41,23 @@ layer waiting for production traffic. for the same reason. - **Automated submission to independent witnesses**, with receipts retained and verified under explicit key policies. Checkpointing itself is live since September 1; - the first external receipt is a manual demonstration, not a deployed submission loop. + the external receipts so far (September 7, and October 20 from a second operator) were + taken by hand, not by a deployed submission loop. - **Receipt-bound witness time and grade**, if those properties are required by policy. - The captured receipt authenticates a root, not the response's grade or an observation time. + The September 7 receipt authenticates a root, not the response's grade or an observation time. + The October 20 receipts from the second operator are different: the one for checkpoint 2 + binds a witness time and a grade, and the one for checkpoint 1 binds a grade and no time. + No policy here requires either property yet, and the September receipt stays as it is. ## Later -- Parallel witnesses and split-view monitoring. The September 7 receipt demonstrates - one checkpoint at one external operator; see the evidence packet linked from README. - A second operator, continuous submission and independent split-view monitoring remain open. +- Parallel witnesses and split-view monitoring. The September 7 receipt covers checkpoint 1 + at one external operator. Since October 20 a second operator, HORIZON SHIELD (a party other + than the registry operator, with its own key, which also holds a registered mirror), has + receipts for checkpoints 1 and 2 + ([docs/evidence/witness-2026-10-20-nenrin](docs/evidence/witness-2026-10-20-nenrin/README.md)). + Nothing there shows a track record or independence beyond a different operator and key. + Continuous submission and independent split-view monitoring remain open. - A conformance suite for third-party verifier implementations, so "I implemented the anchor format" is checkable rather than asserted. diff --git a/docs/evidence/witness-2026-10-20-nenrin/README.md b/docs/evidence/witness-2026-10-20-nenrin/README.md new file mode 100644 index 0000000..ecc9729 --- /dev/null +++ b/docs/evidence/witness-2026-10-20-nenrin/README.md @@ -0,0 +1,105 @@ +# Checkpoints 1 and 2: receipts from a second witness + +Captured October 20, 2026, 03:36:18 UTC, from registry main `555f27a`. The witness is operated by HORIZON SHIELD (The HORIZONs Co., Ltd.), which also holds a registered mirror of this registry (MIRRORS.md). Witness code: [`registry-witness-v0`](https://github.com/ogasurfproject-jpg/horizon-shield/tree/main/workers/hs-ledger/nenrin/registry-witness-v0). + +| | checkpoint 1 (`mmr_size` 1) | checkpoint 2 (`mmr_size` 3) | +|---|---|---| +| signing-body digest | `41138372…968f99a` | `8b21417c…dbc6cf22f` | +| entry hash | `dee1a92d…bed6dfab6` | `df8e89a8…d7d9372ee` | +| leaf / tree size | 0 / 1 | 1 / 2 | +| grade signed under `-65537` | `mmr-verified` | `mmr-verified` | +| CWT `iat` signed | no: the checkpoint was more than 30 days old | yes, `1792467378` (2026-10-20T03:36:18Z) | +| `grade_cryptographically_bound` | true | true | +| `witness_time_established` | false | true | + +Checkpoint 1 already has the Action State receipt of September 7, so it now has two witnesses. Checkpoint 2 had none. + +## How new this witness is + +The witness key first appears in horizon-shield commit `65b0db6` (2026-10-20 03:48 UTC), 12 minutes before this PR was opened. The witness log holds only the two leaves in this packet. The witness is operated by a party other than the registry operator, and that party also runs one of the registered mirrors. Nothing here shows a track record, or independence beyond being a different operator with its own key. + +## Verify offline + +From the repository root: + +``` +python -m pip install --require-hashes -r requirements/witness.txt +for i in 1 2; do + python tools/verify_witness_receipt.py \ + --checkpoint docs/evidence/witness-2026-10-20-nenrin/checkpoint-$i.json \ + --response docs/evidence/witness-2026-10-20-nenrin/witness-response-$i.json \ + --expected-log-id trace-registry/v1 \ + --registry-key bc133259c094f63694b4ec48a295d7501a9a0cd536df5631fb4663c155f7bc90 \ + --witness-key c7c47d073a2c8b348d12c7207aaf7a403f5a3c2695227bf8ed2963ff52f98baf +done +``` + +Expected: `verified: true` and seven checks for each. The limits are as in the table. `tests/test_witness_receipt_nenrin.py` runs both with sockets disabled, and tries altered bodies and swapped receipts. + +## What the grade means here + +`mmr-verified` is signed only after the witness has done three things itself: +- run both of this registry's chain checks over the files at the source commit, with `trace-verify`'s own functions; +- pinned the registry key; +- confirmed that every checkpoint it signed before is still present, byte for byte, on the same line. + +It does not mean anything about the claims the registry anchors. + +## What `iat` means here + +The witness clock at the start of the run. It sits inside the signature, so it binds as a witness statement. On its own it is still the witness's assertion. The witness log's first tree head is anchored to Bitcoin, which gives an upper bound from a clock neither party controls. The proof is in this packet: + +1. `witness-tree-heads.ndjson`: the SHA-256 of its first line, without the newline, is `aaf55bf7163e08c30fa22b4cf0dfe13bbbc37f6876c6c66fff5b0f776b90ef8d`. +2. `jidec-127.txt`: the JIDEC ledger's entry 127 as the ledger serves it (`https://ledger.horizonshield.dev/ledger/127?format=raw`). It names that line SHA-256 and the witness key. Its SHA-256 is `6d8ff0fbc1e2d3d0e3ef2e03b22be891c0cd380dba80d16153861894ec4ced67`. +3. `jidec-127.txt.ots`: the OpenTimestamps proof over that SHA-256 (also at `https://ledger.horizonshield.dev/ledger/127/ots`). It commits to the Bitcoin block header at height 972264 (merkle root `81b695d07d509468fab75fa9dc550808302bb6a7cf667a34058395b06d949653`, block time 2026-10-20 05:09:57 UTC). + +``` +python -m pip install opentimestamps-client +ots info docs/evidence/witness-2026-10-20-nenrin/jidec-127.txt.ots # shows the attestation at 972264 +ots verify docs/evidence/witness-2026-10-20-nenrin/jidec-127.txt.ots # needs a Bitcoin node +ots info docs/evidence/witness-2026-10-20-nenrin/jidec-143.txt.ots # shows the attestation at 972850 +``` + +Entry 127 describes the witness as "independent". That wording is corrected by a later entry, which cites entry 127 and does not edit it: jidec-143.txt (the ledger's entry 143 as served at https://ledger.horizonshield.dev/ledger/143?format=raw, proof also at https://ledger.horizonshield.dev/ledger/143/ots). It uses the wording of this README. + +So the first tree head, the witness key and both receipts existed before 2026-10-20 05:09:57 UTC. The anchor bounds the time from above only. + +## Two anchors, two heights + +The packet holds two anchored ledger entries. Each has its own proof and its own Bitcoin height: + +| record | role | record SHA-256 | proof | Bitcoin height | +|---|---|---|---|---| +| `jidec-127.txt` | entry 127: fixes the witness key and the first tree head | `6d8ff0fbc1e2d3d0e3ef2e03b22be891c0cd380dba80d16153861894ec4ced67` | `jidec-127.txt.ots` | 972264 | +| `jidec-143.txt` | entry 143: corrects how entry 127 describes the witness | `79837a3a2e557c34ec194f940ca2fd1f1934eb0874fed8b48d84738dde5b4eed` | `jidec-143.txt.ots` | 972850 | + +Block 972850 has merkle root `bfb0efe3c54ef54dc8a7101d028b93e93be3b6e8e58fffd7ffd6cd5d27deb31c` and block time 2026-10-24 00:13:42 UTC. + +Inside `jidec-143.txt`, the line `stamped to Bitcoin block 972264` sits in the "What it corrects" block. It names the anchor of entry 127, the entry being corrected. It is not the anchor of entry 143. Entry 143's own proof is `jidec-143.txt.ots`, at height 972850. `jidec-143.txt` is the anchored record and is not edited. + +`tests/test_witness_receipt_nenrin.py` checks this offline, for each entry separately: the record's SHA-256, the proof's OpenTimestamps header (magic, version 1, file hash op `0x08`) and the 32-byte digest that follows it, and that the proof holds exactly one Bitcoin attestation, at the height in the table. For entry 127 it also checks steps 1 and 2 above. It checks that entry 143 cites entry 127's SHA-256, that the height named in the "What it corrects" block of `jidec-143.txt` is the height of entry 127's proof and not of entry 143's, that this table matches the proofs, and that `SHA256SUMS` matches the files. A correction proof that is swapped for entry 127's, truncated, or carries the other height fails. These are structural reads of the proof bytes. The tests do not evaluate the full operation chain, and checking the block header itself needs a node or a block explorer. + +## Limits + +These receipts do not establish: +- registry continuity in the receipt itself (`registry_continuity_established` stays false); +- absence of forks; +- payload retention; +- that every observer saw the same history. + +Two witnesses from different operators on checkpoint 1 are a start on split-view detection, not proof of it. The June entry predates checkpointing and is outside both checkpoints. + +The witness signs one receipt per checkpoint and never reissues it. Its log is append-only, and each tree head carries an RFC 9162 consistency proof from the previous one. + +## Files + +| file | what it is | +|---|---| +| `checkpoint-1.json`, `checkpoint-2.json` | the checkpoints as witnessed, sorted-key compact JSON (the digest is field-derived, see LIMITATIONS.md) | +| `witness-response-1.json`, `witness-response-2.json` | the witness responses, in the shape `--response` reads | +| `verification-1.json`, `verification-2.json` | `trace-verify receipt` output over those bytes | +| `witness-key.json` | the witness public key and its key id | +| `witness-tree-heads.ndjson` | the witness log's signed tree heads at capture | +| `jidec-127.txt`, `jidec-127.txt.ots` | the ledger entry that fixes the first tree head, and its OpenTimestamps proof | +| `jidec-143.txt`, `jidec-143.txt.ots` | the later ledger entry that corrects how entry 127 describes the witness, and its OpenTimestamps proof | +| `SHA256SUMS` | file integrity; not a signed statement | diff --git a/docs/evidence/witness-2026-10-20-nenrin/SHA256SUMS b/docs/evidence/witness-2026-10-20-nenrin/SHA256SUMS new file mode 100644 index 0000000..0c0839b --- /dev/null +++ b/docs/evidence/witness-2026-10-20-nenrin/SHA256SUMS @@ -0,0 +1,13 @@ +5f9aff1078ce709cde4d001b9da10f56213c13d98366c332f6ffaa8419cbfd62 README.md +96e73eecc552ff015a3bacc34889227de9df69d97f1bf3f7267ff2d5bacc5c9e checkpoint-1.json +40bf3f0307f910b235c3a9971c8753cac13d21ad68bbf77aaa154947624c5622 checkpoint-2.json +6d8ff0fbc1e2d3d0e3ef2e03b22be891c0cd380dba80d16153861894ec4ced67 jidec-127.txt +9385edf5e149c1ce6ca51e5b348e12be161658b8c1e16818b9a89e7bf11b6aad jidec-127.txt.ots +79837a3a2e557c34ec194f940ca2fd1f1934eb0874fed8b48d84738dde5b4eed jidec-143.txt +6a1945e8187aca410f3f0f914dd9a147678aa0fe89b43f528f5a30e419b78584 jidec-143.txt.ots +2889591c987ca3c010a2899c28ccd8e1c91830b98e6382240c5dc71e12a071ca verification-1.json +26a82d8f3e5be613cf68bd1b3107720960f52c918b134949e5d71ede6e4669bb verification-2.json +f51e8bc17f487edbf112e47293ef43fb4f765b172401a13560a03b4579608090 witness-key.json +e11d0d5d4abe73e1f8700759035f13af29da1f0260a0764164dab6ae32d31627 witness-response-1.json +ea5ef8e6f7edd89c7febcca9e34cf509a951d0b684b2dc37ea6dfd1c9d4ba109 witness-response-2.json +82173725ad57e32827ae399ecde8d7b2d409f89fc69865bc875cc2dd6efaad2b witness-tree-heads.ndjson diff --git a/docs/evidence/witness-2026-10-20-nenrin/checkpoint-1.json b/docs/evidence/witness-2026-10-20-nenrin/checkpoint-1.json new file mode 100644 index 0000000..f69aa21 --- /dev/null +++ b/docs/evidence/witness-2026-10-20-nenrin/checkpoint-1.json @@ -0,0 +1 @@ +{"key_id":"bc133259c094f63694b4ec48a295d7501a9a0cd536df5631fb4663c155f7bc90","kind":"mmr_checkpoint","log_id":"trace-registry/v1","mmr_size":1,"prev_root":"","prev_size":0,"root":"3af8ddf2c1f429bb4fc670437e48640887f60de809b18f8ccea55fefb0c6639a","signature":"a1ad25e2fd8f56e9c07a345fd5bde66f950afffc9d55af91f586cef1840c4adcd992fc1e277c94f26fb673c0e0ad51a6fcff2e22cd58806133416d4c5c3e930e","timestamp":"2026-09-01T21:39:37Z","v":1} \ No newline at end of file diff --git a/docs/evidence/witness-2026-10-20-nenrin/checkpoint-2.json b/docs/evidence/witness-2026-10-20-nenrin/checkpoint-2.json new file mode 100644 index 0000000..b6ac124 --- /dev/null +++ b/docs/evidence/witness-2026-10-20-nenrin/checkpoint-2.json @@ -0,0 +1 @@ +{"consistency_proof":{"kind":"consistency","new_peaks":["54a106b96982d54465745696c4c5e6210d1b794e803b834dd2c68d035dbfe610"],"old_peaks":["3af8ddf2c1f429bb4fc670437e48640887f60de809b18f8ccea55fefb0c6639a"],"size_a":1,"size_b":3,"v":1,"witness":[["75dd7ace80814feeb475f9cdafd83458db83da3bed38ba6549840183dc2ed313"]]},"key_id":"bc133259c094f63694b4ec48a295d7501a9a0cd536df5631fb4663c155f7bc90","kind":"mmr_checkpoint","log_id":"trace-registry/v1","mmr_size":3,"prev_root":"3af8ddf2c1f429bb4fc670437e48640887f60de809b18f8ccea55fefb0c6639a","prev_size":1,"root":"54a106b96982d54465745696c4c5e6210d1b794e803b834dd2c68d035dbfe610","signature":"35a107f5982d25e07675757e463fea2b5886e3d8c62765096c43e2ebb7a0f8dfe1d78f8c08f6b4551d0684d0ca296fc43ee8d97a712d332fb5d7c43e870bdf09","timestamp":"2026-09-25T18:51:29Z","v":1} \ No newline at end of file diff --git a/docs/evidence/witness-2026-10-20-nenrin/jidec-127.txt b/docs/evidence/witness-2026-10-20-nenrin/jidec-127.txt new file mode 100644 index 0000000..db9d248 --- /dev/null +++ b/docs/evidence/witness-2026-10-20-nenrin/jidec-127.txt @@ -0,0 +1,47 @@ +# nenrin-registry-witness-v0: enrollment and first tree head (registry-witness-v0) + +**Status:** a witness declaration, anchored to the JIDEC ledger and cited, never edited, once anchored. HORIZON SHIELD (The HORIZONs Co., Ltd.) operates an independent witness for the TRACE registry checkpoint chain (agentrust-io/trace-registry, log id trace-registry/v1). This record fixes the witness key and the witness log's first tree head on an anchor the witness does not own. + +## 1. The witness key + + log_id nenrin-registry-witness/v1 + alg Ed25519 + public_key_hex c7c47d073a2c8b348d12c7207aaf7a403f5a3c2695227bf8ed2963ff52f98baf + key_id 5f0e5ba136b3a57f (first 16 hex of SHA-256 of the raw key, as the registry computes it for its other witness) + WITNESS_KEY.json sha256 f51e8bc17f487edbf112e47293ef43fb4f765b172401a13560a03b4579608090 + +## 2. What was witnessed + +Registry commit 555f27afb3acc4fc145d8c9275657f31cef37bef, both checkpoints, after the registry's own two chain checks passed (consistency proofs between checkpoints, and the MMR rebuilt from the raw entries) under the pinned registry key bc133259c094f63694b4ec48a295d7501a9a0cd536df5631fb4663c155f7bc90. + + leaf 0 checkpoint mmr_size 1 (2026-09-01T21:39:37Z) + signing digest 41138372adb1921186ca6a0dbc3433a0ea2f6475cb863205603ab1231968f99a + entry hash dee1a92dad155b56f99cf2284e166e3b6b935528e6d27dec8a4f67bbed6dfab6 + receipt sha256 953ee058d6edc872a9e3fffd8029015b328b65f72c4c852d2b93c48b3cf61dea + grade mmr-verified signed; no iat (the checkpoint is more than 30 days old) + leaf 1 checkpoint mmr_size 3 (2026-09-25T18:51:29Z) + signing digest 8b21417c8e533729461f2bfc6b6b1a95e554bf506e1a2f67a12d173dbc6cf22f + entry hash df8e89a881c295a660b351960e7731c975624b7e4733cfcbf895521f7d9372ee + receipt sha256 8567ebcf36fcb993339c066e1cf9edbc578274d20f8ecf60860563f50ac40343 + grade mmr-verified signed; iat 1792467378 (2026-10-20T03:36:18Z) signed + +The first tree head of the witness log: + + tree_size 2, root 9a835380c2472c3182df666ac66cee67723cde3dd932000c4b1ad80cb05ba4a5 + tree head line sha256 aaf55bf7163e08c30fa22b4cf0dfe13bbbc37f6876c6c66fff5b0f776b90ef8d + +## 3. Verify it yourself + +The receipts verify with the registry's own command (pip install "trace-verify[witness]"): + + trace-verify receipt --checkpoint state/checkpoints/.json --response state/receipts/.post.json \ + --expected-log-id trace-registry/v1 --registry-key bc133259c094f63694b4ec48a295d7501a9a0cd536df5631fb4663c155f7bc90 \ + --witness-key c7c47d073a2c8b348d12c7207aaf7a403f5a3c2695227bf8ed2963ff52f98baf + +The files are in ogasurfproject-jpg/horizon-shield under workers/hs-ledger/nenrin/registry-witness-v0/. witness.py verify rechecks the whole state against a clone of the registry. + +## 4. The honest boundary + +This record fixes when the witness key and these receipts existed: no later than the Bitcoin block this ledger entry is stamped to. It does not certify anything the registry's records claim. It does not show that every observer saw the same registry; that needs other witnesses and someone comparing them. A key holder can always sign a second history. What makes one detectable is this: every tree head is published, and the first one is fixed here. Two heads under this key that no consistency proof joins are proof of misbehaviour. + +**The SHA-256 of this document is anchored to the JIDEC ledger and stamped to Bitcoin. After anchoring, this record cannot be altered. Corrections are later entries that cite this one.** diff --git a/docs/evidence/witness-2026-10-20-nenrin/jidec-127.txt.ots b/docs/evidence/witness-2026-10-20-nenrin/jidec-127.txt.ots new file mode 100644 index 0000000..bf5baee Binary files /dev/null and b/docs/evidence/witness-2026-10-20-nenrin/jidec-127.txt.ots differ diff --git a/docs/evidence/witness-2026-10-20-nenrin/jidec-143.txt b/docs/evidence/witness-2026-10-20-nenrin/jidec-143.txt new file mode 100644 index 0000000..7df2fc3 --- /dev/null +++ b/docs/evidence/witness-2026-10-20-nenrin/jidec-143.txt @@ -0,0 +1,30 @@ +# nenrin-registry-witness-v0: correction to JIDEC entry 127 (how the witness is described) + +**Status:** a correction, anchored to the JIDEC ledger. It cites JIDEC entry 127 and does not edit it. Both stay readable. + +## What it corrects + + corrects JIDEC entry 127, "nenrin-registry-witness-v0: enrollment and first tree head (registry-witness-v0)" + claim sha256 6d8ff0fbc1e2d3d0e3ef2e03b22be891c0cd380dba80d16153861894ec4ced67 + stamped to Bitcoin block 972264 + copies agentrust-io/trace-registry, docs/evidence/witness-2026-10-20-nenrin/jidec-127.txt and jidec-127.txt.ots + +The sentence corrected, from the status line of entry 127: + + HORIZON SHIELD (The HORIZONs Co., Ltd.) operates an independent witness for the TRACE registry checkpoint chain + +## The wording that replaces it + +HORIZON SHIELD (The HORIZONs Co., Ltd.) operates a second witness for the TRACE registry checkpoint chain (agentrust-io/trace-registry, log id trace-registry/v1). It is a party other than the registry operator, with its own key, and it also holds one of the registry's registered mirrors. Nothing in entry 127 or in the evidence packet shows a track record, or independence beyond being a different operator with its own key. HORIZON SHIELD does not describe itself as independent. + +This follows the evidence packet's README. The registry's LIMITATIONS.md also calls it a second witness. + +## What stays as it is + +Every key, digest, receipt and tree head in entry 127, and its section 4 (the honest boundary). This record changes no hash and no receipt. + +## Why + +Raised in the review of agentrust-io/trace-registry#143 on 2026-10-23: entry 127 and the packet said two different things at once. Entry 127 cannot be edited after anchoring, so the correction is this later entry that cites it. + +**The SHA-256 of this document is anchored to the JIDEC ledger and stamped to Bitcoin. After anchoring, this record cannot be altered. Corrections are later entries that cite this one.** diff --git a/docs/evidence/witness-2026-10-20-nenrin/jidec-143.txt.ots b/docs/evidence/witness-2026-10-20-nenrin/jidec-143.txt.ots new file mode 100644 index 0000000..cd9b6c3 Binary files /dev/null and b/docs/evidence/witness-2026-10-20-nenrin/jidec-143.txt.ots differ diff --git a/docs/evidence/witness-2026-10-20-nenrin/verification-1.json b/docs/evidence/witness-2026-10-20-nenrin/verification-1.json new file mode 100644 index 0000000..f69c102 --- /dev/null +++ b/docs/evidence/witness-2026-10-20-nenrin/verification-1.json @@ -0,0 +1,27 @@ +{ + "verified": true, + "checks": { + "checkpoint_structure": true, + "registry_identity": true, + "checkpoint_signature": true, + "checkpoint_receipt_binding": true, + "receipt_profile": true, + "receipt_signature_and_inclusion": true, + "response_coordinates": true + }, + "limits": { + "witness_time_established": false, + "grade_cryptographically_bound": true, + "registry_continuity_established": false, + "full_checkpoint_envelope_witnessed": false + }, + "checkpoint_signing_digest": "41138372adb1921186ca6a0dbc3433a0ea2f6475cb863205603ab1231968f99a", + "entry_hash": "dee1a92dad155b56f99cf2284e166e3b6b935528e6d27dec8a4f67bbed6dfab6", + "root": "23615431a7b06dec5d2a9d22ddade4592636faebbd2a41bf0d6b9b8fa43eff76", + "leaf_index": 0, + "tree_size": 1, + "reported_grade": "mmr-verified", + "signed_iat": null, + "signed_grade": "mmr-verified", + "witness_key": "c7c47d073a2c8b348d12c7207aaf7a403f5a3c2695227bf8ed2963ff52f98baf" +} diff --git a/docs/evidence/witness-2026-10-20-nenrin/verification-2.json b/docs/evidence/witness-2026-10-20-nenrin/verification-2.json new file mode 100644 index 0000000..9fbae5b --- /dev/null +++ b/docs/evidence/witness-2026-10-20-nenrin/verification-2.json @@ -0,0 +1,27 @@ +{ + "verified": true, + "checks": { + "checkpoint_structure": true, + "registry_identity": true, + "checkpoint_signature": true, + "checkpoint_receipt_binding": true, + "receipt_profile": true, + "receipt_signature_and_inclusion": true, + "response_coordinates": true + }, + "limits": { + "witness_time_established": true, + "grade_cryptographically_bound": true, + "registry_continuity_established": false, + "full_checkpoint_envelope_witnessed": false + }, + "checkpoint_signing_digest": "8b21417c8e533729461f2bfc6b6b1a95e554bf506e1a2f67a12d173dbc6cf22f", + "entry_hash": "df8e89a881c295a660b351960e7731c975624b7e4733cfcbf895521f7d9372ee", + "root": "9a835380c2472c3182df666ac66cee67723cde3dd932000c4b1ad80cb05ba4a5", + "leaf_index": 1, + "tree_size": 2, + "reported_grade": "mmr-verified", + "signed_iat": 1792467378, + "signed_grade": "mmr-verified", + "witness_key": "c7c47d073a2c8b348d12c7207aaf7a403f5a3c2695227bf8ed2963ff52f98baf" +} diff --git a/docs/evidence/witness-2026-10-20-nenrin/witness-key.json b/docs/evidence/witness-2026-10-20-nenrin/witness-key.json new file mode 100644 index 0000000..6ee99a9 --- /dev/null +++ b/docs/evidence/witness-2026-10-20-nenrin/witness-key.json @@ -0,0 +1,9 @@ +{ + "log_id": "nenrin-registry-witness/v1", + "alg": "Ed25519", + "public_key_hex": "c7c47d073a2c8b348d12c7207aaf7a403f5a3c2695227bf8ed2963ff52f98baf", + "key_id": "5f0e5ba136b3a57f", + "key_id_rule": "first 16 hex characters of SHA-256(raw public key), as the registry computes it for its other witness", + "operator": "HORIZON SHIELD (The HORIZONs Co., Ltd.)", + "contact": "contact@the-horizons-innovation.com" +} diff --git a/docs/evidence/witness-2026-10-20-nenrin/witness-response-1.json b/docs/evidence/witness-2026-10-20-nenrin/witness-response-1.json new file mode 100644 index 0000000..4da5a68 --- /dev/null +++ b/docs/evidence/witness-2026-10-20-nenrin/witness-response-1.json @@ -0,0 +1 @@ +{"entry_hash":"dee1a92dad155b56f99cf2284e166e3b6b935528e6d27dec8a4f67bbed6dfab6","entry_hash_scheme":"legacy","grade":"mmr-verified","leaf_index":0,"receipt_b64":"0oRYGaMZAYsBOgABAABsbW1yLXZlcmlmaWVkASehGQGMoSCBRIMBAID2WEAvDuFp+VM1pI8BRkiSaTBfnFHlB3m8iJ52BzHhIzpSTJB5ryp50Iw+j5kUcPub795Qa3CZrvOypatwYuvd9B0A","tree_size":1} \ No newline at end of file diff --git a/docs/evidence/witness-2026-10-20-nenrin/witness-response-2.json b/docs/evidence/witness-2026-10-20-nenrin/witness-response-2.json new file mode 100644 index 0000000..3342ea6 --- /dev/null +++ b/docs/evidence/witness-2026-10-20-nenrin/witness-response-2.json @@ -0,0 +1 @@ +{"entry_hash":"df8e89a881c295a660b351960e7731c975624b7e4733cfcbf895521f7d9372ee","entry_hash_scheme":"legacy","grade":"mmr-verified","leaf_index":1,"receipt_b64":"0oRYIaQZAYsBD6EGGmrW4bI6AAEAAGxtbXItdmVyaWZpZWQBJ6EZAYyhIIFYJoMCAYFYICNhVDGnsG3sXSqdIt2t5FkmNvrrvSpBvw1rm4+kPv929lhAwDn7O+1VzQMQwsS177A9tGQ3KginFBmZH9bkNsLRTWVM4BSq9AtFuVNKWjHBJkCgmhdd0YPRbdhMrUtOHqw0Ag==","tree_size":2} \ No newline at end of file diff --git a/docs/evidence/witness-2026-10-20-nenrin/witness-tree-heads.ndjson b/docs/evidence/witness-2026-10-20-nenrin/witness-tree-heads.ndjson new file mode 100644 index 0000000..3d68b30 --- /dev/null +++ b/docs/evidence/witness-2026-10-20-nenrin/witness-tree-heads.ndjson @@ -0,0 +1 @@ +{"consistency_proof":[],"kind":"witness_tree_head","log_id":"nenrin-registry-witness/v1","prev_root":"","prev_size":0,"root":"9a835380c2472c3182df666ac66cee67723cde3dd932000c4b1ad80cb05ba4a5","signature":"4ac4a7c8ae82e6f7b0d4bf56e3a4ab0831d3177ff66845a3e6e4b97a356ec8603a7631b38a9eda36f86432fca207153bb5ccad2eeec530357381e05146854403","timestamp":"2026-10-20T03:36:18Z","tree_size":2,"v":1,"witness_key":"c7c47d073a2c8b348d12c7207aaf7a403f5a3c2695227bf8ed2963ff52f98baf"} diff --git a/tests/test_witness_receipt_nenrin.py b/tests/test_witness_receipt_nenrin.py new file mode 100644 index 0000000..0973b00 --- /dev/null +++ b/tests/test_witness_receipt_nenrin.py @@ -0,0 +1,224 @@ +"""The second witness's receipts for checkpoints 1 and 2, checked offline as captured.""" +import copy +import hashlib +import json +import re +import socket +import sys +import unittest +from pathlib import Path +from unittest.mock import patch + +ROOT = Path(__file__).resolve().parents[1] +sys.path.insert(0, str(ROOT / 'tools')) +from verify_witness_receipt import load_json, signing_body, signing_body_digest, verify + +PACKET = ROOT / 'docs/evidence/witness-2026-10-20-nenrin' +REGISTRY_KEY = 'bc133259c094f63694b4ec48a295d7501a9a0cd536df5631fb4663c155f7bc90' +WITNESS_KEY = 'c7c47d073a2c8b348d12c7207aaf7a403f5a3c2695227bf8ed2963ff52f98baf' +OTHER_WITNESS_KEY = '39bb654c9dc0afe1c0edef0deffaa69099b8518836c9ba26e0491535840f96b5' + +# Each anchored ledger entry in the packet: its record, the SHA-256 its proof commits to, and the +# Bitcoin height of its own proof. Entry 127 fixes the witness key and the first tree head; entry 143 +# corrects how entry 127 describes the witness. The two heights must never stand in for each other. +ENTRY_127 = ('jidec-127.txt', '6d8ff0fbc1e2d3d0e3ef2e03b22be891c0cd380dba80d16153861894ec4ced67', 972264) +ENTRY_143 = ('jidec-143.txt', '79837a3a2e557c34ec194f940ca2fd1f1934eb0874fed8b48d84738dde5b4eed', 972850) +OTS_MAGIC = b'\x00OpenTimestamps\x00\x00Proof\x00\xbf\x89\xe2\xe8\x84\xe8\x92\x94' +BTC_TAG = bytes.fromhex('0588960d73d71901') + + +def read_entry(entry): + return (PACKET / entry[0]).read_bytes(), (PACKET / (entry[0] + '.ots')).read_bytes() + + +def _varuint(data, i): + value, shift = 0, 0 + while True: + byte = data[i] + i += 1 + value |= (byte & 0x7f) << shift + shift += 7 + if not byte & 0x80: + return value, i + + +def bitcoin_heights(proof): + """Heights of the Bitcoin attestations in a proof, read structurally: tag, payload length, height varint. + + A structural read of the bytes, not an evaluation of the operation chain. None if an attestation is cut short. + """ + heights, i = [], proof.find(BTC_TAG) + while i != -1: + try: + size, start = _varuint(proof, i + len(BTC_TAG)) + height, end = _varuint(proof, start) + except IndexError: + return None + if end != start + size or end > len(proof): + return None + heights.append(height) + i = proof.find(BTC_TAG, end) + return heights + + +def anchor_problems(record, proof, digest_hex, height): + """What is wrong with this record and proof as one anchored entry; [] if nothing.""" + problems = [] + claim = hashlib.sha256(record).digest() + if claim.hex() != digest_hex: + problems.append('record SHA-256 is not the expected digest') + head = len(OTS_MAGIC) + if not proof.startswith(OTS_MAGIC): + problems.append('no OpenTimestamps magic') + elif proof[head:head + 2] != b'\x01\x08': + problems.append('not version 1 with file hash op sha256') + elif proof[head + 2:head + 34] != claim: + problems.append('proof commits to another digest') + heights = bitcoin_heights(proof) + if heights != [height]: + problems.append(f'Bitcoin attestation heights {heights}, expected exactly [{height}]') + return problems + + +def check(i, cp=None, response=None, **kw): + args = dict(registry_key=REGISTRY_KEY, witness_key=WITNESS_KEY, expected_log_id='trace-registry/v1') + args.update(kw) + cp = load_json(PACKET / f'checkpoint-{i}.json') if cp is None else cp + response = load_json(PACKET / f'witness-response-{i}.json') if response is None else response + return verify(cp, response, **args) + + +class NenrinWitnessReceiptTests(unittest.TestCase): + def test_both_receipts_verify_with_network_disabled(self): + with patch.object(socket, 'socket', side_effect=AssertionError('network forbidden')): + first, second = check(1), check(2) + self.assertTrue(first['verified'], first) + self.assertTrue(second['verified'], second) + self.assertEqual((first['leaf_index'], first['tree_size']), (0, 1)) + self.assertEqual((second['leaf_index'], second['tree_size']), (1, 2)) + + def test_limits_are_what_the_packet_states(self): + first, second = check(1), check(2) + self.assertTrue(first['limits']['grade_cryptographically_bound']) + self.assertFalse(first['limits']['witness_time_established']) + self.assertTrue(second['limits']['grade_cryptographically_bound']) + self.assertTrue(second['limits']['witness_time_established']) + self.assertEqual(second['signed_iat'], 1792467378) + self.assertEqual(second['signed_grade'], 'mmr-verified') + for r in (first, second): + self.assertFalse(r['limits']['registry_continuity_established']) + self.assertFalse(r['limits']['full_checkpoint_envelope_witnessed']) + + def test_checkpoint_1_is_the_one_the_first_witness_saw(self): + first = check(1) + self.assertEqual(first['checkpoint_signing_digest'], + '41138372adb1921186ca6a0dbc3433a0ea2f6475cb863205603ab1231968f99a') + self.assertEqual(first['entry_hash'], load_json(ROOT / 'docs/evidence/witness-2026-09-07/witness-post.json')['entry_hash']) + + def test_checkpoint_2_is_the_registry_entry(self): + line = (ROOT / 'registry/2026/09/25.ndjson').read_text(encoding='utf-8').splitlines()[0] + cp = json.loads(line)['mmr_checkpoint'] + self.assertEqual(signing_body_digest(signing_body(cp)).hex(), check(2)['checkpoint_signing_digest']) + + def test_swapped_receipts_rejected(self): + self.assertFalse(check(1, response=load_json(PACKET / 'witness-response-2.json'))['verified']) + self.assertFalse(check(2, response=load_json(PACKET / 'witness-response-1.json'))['verified']) + + def test_wrong_witness_key_rejected(self): + self.assertFalse(check(2, witness_key=OTHER_WITNESS_KEY)['verified']) + + def test_altered_checkpoint_rejected(self): + cp = copy.deepcopy(load_json(PACKET / 'checkpoint-2.json')) + cp['root'] = '00' * 32 + self.assertFalse(check(2, cp=cp)['verified']) + + def test_reported_grade_must_match_the_signed_one(self): + response = copy.deepcopy(load_json(PACKET / 'witness-response-2.json')) + response['grade'] = 'countersigned-observed' + result = check(2, response=response) + self.assertTrue(result['verified']) + self.assertFalse(result['limits']['grade_cryptographically_bound']) + + + def test_bitcoin_anchor_chain_offline(self): + head = (PACKET / 'witness-tree-heads.ndjson').read_bytes().split(b'\n')[0] + head_sha = hashlib.sha256(head).hexdigest() + self.assertEqual(head_sha, 'aaf55bf7163e08c30fa22b4cf0dfe13bbbc37f6876c6c66fff5b0f776b90ef8d') + record = (PACKET / 'jidec-127.txt').read_bytes() + self.assertIn(head_sha.encode(), record) + self.assertIn(WITNESS_KEY.encode(), record) + claim = hashlib.sha256(record).digest() + self.assertEqual(claim.hex(), ENTRY_127[1]) + proof = (PACKET / 'jidec-127.txt.ots').read_bytes() + self.assertTrue(proof.startswith(OTS_MAGIC)) + # version 1, file hash op sha256 (0x08), then the 32-byte digest the proof commits to + self.assertEqual(proof[len(OTS_MAGIC):len(OTS_MAGIC) + 2], b'\x01\x08') + self.assertEqual(proof[len(OTS_MAGIC) + 2:len(OTS_MAGIC) + 34], claim) + # the Bitcoin attestation: its tag, a 3-byte payload, height 972264 as a varint + self.assertIn(BTC_TAG + bytes.fromhex('03' 'e8ab3b'), proof) + self.assertEqual(anchor_problems(*read_entry(ENTRY_127), *ENTRY_127[1:]), []) + + def test_correction_anchor_offline(self): + record, proof = read_entry(ENTRY_143) + claim = hashlib.sha256(record).digest() + self.assertEqual(claim.hex(), '79837a3a2e557c34ec194f940ca2fd1f1934eb0874fed8b48d84738dde5b4eed') + self.assertTrue(proof.startswith(OTS_MAGIC)) + self.assertEqual(proof[len(OTS_MAGIC):len(OTS_MAGIC) + 2], b'\x01\x08') + self.assertEqual(proof[len(OTS_MAGIC) + 2:len(OTS_MAGIC) + 34], claim) + # height 972850 as a varint + self.assertIn(BTC_TAG + bytes.fromhex('03' 'b2b03b'), proof) + self.assertEqual(anchor_problems(record, proof, *ENTRY_143[1:]), []) + # the correction cites the entry it corrects by that entry's SHA-256 + self.assertIn(ENTRY_127[1].encode(), record) + + def test_the_two_heights_are_separate(self): + own_127 = bitcoin_heights(read_entry(ENTRY_127)[1]) + own_143 = bitcoin_heights(read_entry(ENTRY_143)[1]) + self.assertEqual(own_127, [972264]) + self.assertEqual(own_143, [972850]) + # jidec-143.txt names a height only in its "What it corrects" block: that is entry 127's height + record = read_entry(ENTRY_143)[0].decode('utf-8') + corrects = record.split('## What it corrects', 1)[1].split('\n## ', 1)[0] + self.assertEqual(re.findall(r'claim sha256\s+([0-9a-f]{64})', corrects), [ENTRY_127[1]]) + named = [int(h) for h in re.findall(r'Bitcoin block (\d+)', record)] + self.assertEqual(named, [int(h) for h in re.findall(r'stamped to\s+Bitcoin block (\d+)', corrects)]) + self.assertEqual(named, own_127) + self.assertNotIn(own_143[0], named) + # the README's table gives each entry its own height, and it matches the proofs + rows = re.findall(r'^\| `(jidec-\d+\.txt)` \|[^|]*\| `([0-9a-f]{64})` \| `(jidec-\d+\.txt\.ots)` \| (\d+) \|$', + (PACKET / 'README.md').read_text(encoding='utf-8'), re.M) + self.assertEqual(rows, [(e[0], e[1], e[0] + '.ots', str(e[2])) for e in (ENTRY_127, ENTRY_143)]) + + def test_swapped_or_altered_correction_proof_rejected(self): + record_127, proof_127 = read_entry(ENTRY_127) + record_143, proof_143 = read_entry(ENTRY_143) + expect_143 = ENTRY_143[1:] + # entry 127's proof in place of the correction's, and the reverse + self.assertNotEqual(anchor_problems(record_143, proof_127, *expect_143), []) + self.assertNotEqual(anchor_problems(record_127, proof_143, *ENTRY_127[1:]), []) + # the correction checked against entry 127's height, the misreading this test exists for + self.assertNotEqual(anchor_problems(record_143, proof_143, ENTRY_143[1], ENTRY_127[2]), []) + # the correction's proof with its height bytes swapped for entry 127's: the digest still matches + swapped = proof_143.replace(BTC_TAG + bytes.fromhex('03b2b03b'), BTC_TAG + bytes.fromhex('03e8ab3b')) + self.assertNotEqual(swapped, proof_143) + self.assertEqual(swapped[len(OTS_MAGIC) + 2:len(OTS_MAGIC) + 34], hashlib.sha256(record_143).digest()) + self.assertNotEqual(anchor_problems(record_143, swapped, *expect_143), []) + # truncated: before the Bitcoin attestation, inside it, and inside the digest + cut = proof_143.find(BTC_TAG) + for n in (cut, cut + 10, len(OTS_MAGIC) + 20): + self.assertNotEqual(anchor_problems(record_143, proof_143[:n], *expect_143), [], n) + # a second Bitcoin attestation appended + self.assertNotEqual(anchor_problems(record_143, proof_143 + BTC_TAG + bytes.fromhex('03e8ab3b'), *expect_143), []) + # the record altered by one byte + self.assertNotEqual(anchor_problems(record_143.replace(b'972264', b'972850'), proof_143, *expect_143), []) + + def test_sha256sums_match_the_packet(self): + lines = (PACKET / 'SHA256SUMS').read_text(encoding='utf-8').splitlines() + listed = dict(reversed(line.split(' ', 1)) for line in lines) + self.assertEqual(set(listed), {p.name for p in PACKET.iterdir()} - {'SHA256SUMS'}) + for name, digest in listed.items(): + self.assertEqual(hashlib.sha256((PACKET / name).read_bytes()).hexdigest(), digest, name) + + +if __name__ == '__main__': + unittest.main()