An open specification for zero-knowledge proofs over R+2 receipts and R+3 audit bundles — prove a compliance property holds without revealing the underlying receipts. Groth16 / BN254. MIT-licensed.
🌐 Full spec: https://dcslabs.ai/standard/r4 🔗 Built on: R+2 + R+3
R+2 makes every agent action signable; R+3 aggregates them into Merkle-rooted audit bundles. Both share one property: the verifier sees the data.
R+4 removes that. An R+4 proof is a short cryptographic object (~200 bytes on
BN254) that lets a verifier check a specific, pre-committed statement about a
set of receipts — e.g. "≥ 10,000 receipts in this bundle were signed under
policy pol_v3 with amount ≤ $5.00" — without learning anything else:
not the receipts, not the principals, not the exact count.
Where R+2 makes every action provable and R+3 makes every period provable, R+4 makes every compliance claim verifiable without disclosure.
The reference statement class is r4-threshold-count-v1 — implemented in
reference/circuits/threshold-count.circom. It enforces, in-circuit:
- a SHA-256 Merkle path from each consumed receipt to the public bundle root,
- the receipt's EdDSA signature,
- the receipt timestamp inside the declared window,
- policy-ID and amount-cap bounds.
Compiled profile: 1,197,221 R1CS constraints (64-receipt Groth16 / BN254 profile).
cd reference
npm install
# 1. compile circuit → R1CS → dev keys → Solidity verifier
npm run build
# 2. generate a real Groth16 proof from the worked example
npm run prove -- --bundle example-bundle.json \
--statement example-statement.json --artifacts ./artifacts --out proof.json
# 3. verify it
npm run verify -- proof.jsonExpected: the witness suite passes 7/7, and the verifier prints
groth16 verify : valid.
Trust note.
npm run buildproduces development proving/verifying keys from a single-party setup — fine for testing the circuit and pipeline. The production keys come from the multi-party trusted-setup ceremony, which has now been completed — seereference/ceremony/CEREMONY_TRANSCRIPT.md. The production keys are a v0.1 ceremony (5 contributors, family + internal) — verifiedZKey Ok!, Bitcoin-beacon sealed.
The dev-key Groth16 Solidity verifier was deployed to Base Sepolia and its
verifyProof() returned true on-chain.
| Item | Value |
|---|---|
| Network | Base Sepolia (testnet), chain ID 84532 |
| Verifier contract | 0x91d98bc1…0553e1cd |
| Deployment tx | 0x31e7a6b2…1617609e7 |
| Keys | development keys |
The production Groth16 verifier, built from the completed ceremony's
phase2_final.zkey, is live on Base mainnet.
| Item | Value |
|---|---|
| Network | Base mainnet, chain ID 8453 |
| Verifier contract | 0xabf8626c20e6bf21a9fdcd4e9f80c17ac8963209 |
| Deployment tx | 0x9df6edff…02f01f53f |
| Block | 46,343,838 |
| Keys | production — v0.1 trusted-setup ceremony |
Ceremony record: reference/ceremony/CEREMONY_TRANSCRIPT.md
— 5 contributors, Bitcoin-beacon sealed, ZKey Ok!.
r4-standard/
├── reference/
│ ├── circuits/ # threshold-count.circom — the reference circuit
│ ├── prover/ # generate a Groth16 proof from a bundle + statement
│ ├── verifier/ # verify a proof off-chain
│ ├── solidity/ # generated Groth16 Solidity verifier
│ ├── scripts/ # deploy + on-chain verify scripts
│ ├── ceremony/ # multi-party trusted-setup coordination
│ ├── test/ # witness + statement-logic test suite
│ ├── build.sh # compile → R1CS → keys → Solidity verifier
│ ├── COMPILE_RUNBOOK.md # full compile procedure (circom + snarkjs)
│ └── example-*.json # worked bundle / statement / proof
├── CONTRIBUTING.md
├── SECURITY.md
├── CODE_OF_CONDUCT.md
└── LICENSE
The canonical specification text lives on the website (https://dcslabs.ai/standard/r4). This repository holds the reference circuit and proof tooling.
The specification and reference implementation are released under the MIT License. DCS AI Technologies L.L.C holds no patents covering R+4 and has filed none.
- Editorial: standards@dcslabs.ai
- Security: security@dcslabs.ai
- Source-of-truth spec: https://dcslabs.ai/standard/r4
— DCS AI Technologies L.L.C, Dubai