# How to reproduce CAIN-42 checks

This document tells you exactly what you can reproduce, how, and what you cannot.

**IP / disclosure policy (read first).** CAIN-42 publishes *verification* artefacts —
evidence bundles, hashes, public keys, standalone zero-CAIN-import verifiers, abstract
TLA+ models and their results. It **withholds the proprietary implementation source**
(`platform-gateway/`, `cain/`, and the test suite) as a trade secret. There is no public
git remote. Therefore you can **reproduce the verification of CAIN's evidence** without
CAIN's code, but you **cannot rebuild CAIN from this package**. That withholding is a real
reproducibility limit and is recorded as such in `known-limitations.md`.

Each check below is labelled:

- **OFFLINE** — needs no network, no CAIN service.
- **READ-ONLY ONLINE** — an unauthenticated HTTP GET against a public endpoint.
- **SOURCE REQUIRED** — cannot be done without the withheld repository.
- **SIDE-EFFECTING / DISRUPTIVE** — requires explicit operator approval; not offered publicly.

---

## 0. Get the reproduction pack

**OFFLINE** (after download)

```
curl -sO https://cainstudio.online/evidence/verification-pack/verify_all.py
curl -sO https://cainstudio.online/evidence/verification-pack/requirements.txt
python3 -m pip install -r requirements.txt
python3 verify_all.py            # offline checks only
python3 verify_all.py --online   # adds read-only public checks
```

Everything in the pack is plain text and readable before you run it. It does not use
`sudo`, does not execute remote installers, does not read unrelated local files, does not
upload anything, and sends no telemetry.

---

## 1. Quorum certificates — **OFFLINE, REPRODUCIBLE**

```
python3 verify_pbft_qc_bundle.py PBFT_QC_BUNDLE.json
```

Expected tail: `ALL_CHECKS_PASSED: 29/29 checks, 160 certificates verified`.
This was verified by the operator on 2026-10-09 (Python 3.14.4, cryptography 46.0.5).
What it checks: membership configuration hash, every COMMIT_QC/PREPARE_QC Ed25519
signature by distinct pinned members, `>= 2f+1 = 3` signers, domain separation
(COMMIT vs PREPARE), the commit-only rule, the decision chain across all four nodes, view
changes, and authorization certificates — plus seven negative controls that must FAIL.
What it does **not** prove: independent machines, distributed consensus, or infrastructure
independence. The sample was produced on a disposable single-host cluster, not the live
`cain-mr-01/02`.

## 2. Formal models — **OFFLINE, REPRODUCIBLE** (TLC tool required)

```
# from REPRODUCE.txt
BASE=https://cainstudio.online/proof/bundle/formal-2026-09-27
curl -so CAINPBFTCommitSafety.tla "$BASE/CAINPBFTCommitSafety.tla.txt"
curl -so CAINMCPGateAuthorization.tla "$BASE/CAINMCPGateAuthorization.tla.txt"
# write the .cfg files exactly as shown in REPRODUCE.txt, then:
java -cp tla2tools.jar tlc2.TLC -deadlock -config CAINPBFTCommitSafety.cfg CAINPBFTCommitSafety.tla
```

Per-run distinct-state counts (from the published `.tlc.json`):

| Model | Run | Distinct states |
|---|---|---|
| CAINPBFTCommitSafety | fixed, Byzantine replica n4 | 290,806 |
| CAINPBFTCommitSafety | fixed, Byzantine leader n1 | 670,340 |
| CAINPBFTCommitSafety | fixed, no Byzantine | 4,198,642 |
| CAINMCPGateAuthorization | Byzantine member n4 | 553,996 |
| CAINMCPGateAuthorization | no Byzantine | 1,591,308 |
| **Sum** | | **7,305,092** |

Eight mutants must each fail (2 PBFT + 6 MCPGate); if a mutant does not fail, the run is
not evidence. Bounded models only — **not** a proof about the Python code.

## 3. Hourly proof chain — **ONLINE READ-ONLY, REPRODUCIBLE**

```
python3 verify_hourly_proofs.py https://cainstudio.online/proof/bundle/hourly-proof/
```

Checks each proof's Ed25519 signature against the pinned evidence-root key and that each
proof hash-chains to the previous. It cannot observe live revocation.

## 4. Soak checkpoints — **ONLINE READ-ONLY, REPRODUCIBLE (chain only)**

```
python3 verify_soak.py https://cainstudio.online/proof/bundle/soak-multiregion-2026-10-06/
```

Verifies checkpoint signatures and hash-chaining and the counters. Verdict will be
`RUNNING` until the 72 hours complete; a `RUNNING` soak is **not** a pass.

## 5. Published test report — **READ-ONLY (source required to re-run)**

Read `TEST_MANIFEST.json` and `junit/*.xml`. Re-running the suite is **SOURCE REQUIRED**
and therefore **NOT_ESTABLISHED** for an outside reviewer. Reconciliation:
`1,963 passed + 7 skipped + 8 expected failures = 1,978`.

## 6. Live status — **READ-ONLY ONLINE**

```
curl -s https://cainstudio.online/fabric/status
curl -s https://cainstudio.online/api/v1/live-cluster/status
curl -s https://cainstudio.online/evidence/status.json
```

## 7. Bypass-resistance demonstrations — **SIDE-EFFECTING, NOT OFFERED**

The ten end-to-end enforcement demonstrations are not publicly runnable. They require an
isolated demo tenant, synthetic data, quotas and explicit operator approval, and must never
run against production or customers. Status: **NOT_ESTABLISHED**.
