Org↔Operator ZK settlement on Creditcoin L1 · L1 vs L2 sizing · Network Architect · 2026-07-02 · Draft
Basis: measured D5/D6 Groth16 benchmarks (Foundry --via-ir, 75M block, V3 circuit) + SpaceNetwork Billing Whitepaper (Nguyen/Lebée, Jun 2026).
Earlier analyses carried one soft assumption: will the cheap "warm" storage path actually apply in production? The whitepaper settles it with two facts:
org‖client‖seq, and seq is a client-local sequential
counter ("the client increments the sequence for each new session"). Not random.(org, client, seq/256) — one storage word holds a
client's 256 consecutive flows.Because seq is sequential, a busy client's flows land in the same word, contiguously, by construction. No scattering, no probability.
| Action | Gas | When charged | Source |
|---|---|---|---|
| Groth16 verify (flat) | 236,939 | once per submitProof tx | v3-verify-matrix.csv |
| Verify amortized / hop | 1,185 | per operator-hop (÷ N=200) | derived |
| Cold replay write | 26,533 | first bit in a client word | v3-coldwarm.csv N200 op0 |
| Warm replay write | 4,637 | every subsequent bit | v3-coldwarm.csv N200 op1–9 |
| Tree depth D | Leaf slots 2^D | Max hops | Merkle siblings / row |
|---|---|---|---|
| D = 5 | 32 | 32 | 5 |
| D = 6 | 64 | 64 | 6 |
We evaluate four hop scenarios throughout: mean H=9.3, peak H=18.5 (telemetry), D5 max H=32, D6 max H=64 (design ceilings).
| Input | Value | Source |
|---|---|---|
| Clients (UTN) | 50,000 | scenario |
| Flows per client / 5min | 4.125 | telemetry anchor (41,250 ÷ 10,000) |
| Total flows / 5min | 206,250 | 50,000 × 4.125 |
| Replay word span | 256 flows/word | paper key (org,client,seq/256) |
| Scenario | Gas / 5min | warm % | L1 | L2-A (5s) | L2-B (2s) |
|---|---|---|---|---|---|
| Mean (H=9.3) | 12.30B | 70% | 820% | 68% | 27% |
| Peak (H=18.5) | 23.34B | 75% | 1,556% | 130% | 52% |
| D5 max (H=32) | 39.55B | 77% | 2,637% | 220% | 88% |
| D6 max (H=64) | 77.98B | 78% | 5,198% | 433% | 173% |
Cost is linear in flow rate. Table in 5,000-flow steps. Each cell shows gas per 5-min (billions) on top, and below it the % of each chain's budget — L1, L2-A, L2-B (budgets 1.5B / 18B / 45B). Color: green <25% · blue 25–50% · orange 50–100% (over EIP-1559 target) · red ≥100% (over block gas limit).
| flows / 5min | mean (9.3) | peak (18.5) | D5 = 32 | D6 = 64 | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 5,000 | 0.30
| 0.57
| 0.96
| 1.89
| ||||||||||||||||||||||||
| 10,000 | 0.60
| 1.13
| 1.92
| 3.78
| ||||||||||||||||||||||||
| 15,000 | 0.89
| 1.70
| 2.88
| 5.67
| ||||||||||||||||||||||||
| 20,000 | 1.19
| 2.26
| 3.84
| 7.56
| ||||||||||||||||||||||||
| 25,000 | 1.49
| 2.83
| 4.79
| 9.45
| ||||||||||||||||||||||||
| 30,000 | 1.79
| 3.40
| 5.75
| 11.34
| ||||||||||||||||||||||||
| 35,000 | 2.09
| 3.96
| 6.71
| 13.23
| ||||||||||||||||||||||||
| 40,000 | 2.38
| 4.53
| 7.67
| 15.12
| ||||||||||||||||||||||||
| 45,000 | 2.68
| 5.09
| 8.63
| 17.01
| ||||||||||||||||||||||||
| 50,000 | 2.98
| 5.66
| 9.59
| 18.90
| ||||||||||||||||||||||||
| 55,000 | 3.28
| 6.22
| 10.55
| 20.79
|
Settlement gas per 5-min per chain, with the EIP-1559 gas-raising target (amber) and block gas limit (gray) drawn per chain. X-axis extended past the data so end labels are readable.
% of each chain's own 5-min block budget, one panel per chain (y-scales differ: L1 3000%, L2-A 500%, L2-B 200%). The amber EIP-1559 gas-raising target (50%) is the real operating ceiling — base fee rises ~12.5%/block above it, so gas price climbs before the block gas limit. Keep sustained load under the amber line to avoid fee escalation.
| Scenario | L1 (1.5B) | L2-A (18B) | L2-B (45B) |
|---|---|---|---|
| mean (9.3) | 25,161 | 301,934 | 754,834 |
| peak (18.5) | 13,254 | 159,045 | 397,613 |
| D5 = 32 | 7,822 | 93,863 | 234,658 |
| D6 = 64 | 3,968 | 47,611 | 119,028 |
Warm is 70–78% because the current design settles per operator-hop: every operator on
every flow submits its own transaction and writes its own replay bit. The multiplier is
flows × hops — up to 13.2M operator-hops at the D6 ceiling. Nothing in the
current design compresses that count.
Batch size N = flows settled per proof. Larger N amortizes the flat verify over more flows, lowering per-flow cost. Presented at both tree depths: 7.a D=5 (32-hop paths) and 7.b D=6 (64-hop paths).
submitProof gas, verify, or storage. So the gas rows in 7.a and 7.b are the same by
construction — only constraints and proving time differ between them.| Metric | N = 50 | N = 200 | N = 300 | N = 400 |
|---|---|---|---|---|
| Status | measured | measured | measured | projected |
| Circuit constraints (D5) | 2,167,422 | 8,613,660 | 12,891,566 | 17,169,472 |
submitProof gas (total) | 1,547,070 | 5,299,053 | 7,801,543 | 10,304,033 |
| Per-flow gas (÷N) | 30,941 | 26,495 | 26,005 | 25,760 |
| Verify gas / flow (÷N) | 4,739 | 1,185 | 790 | 592 |
submitProof % of 75M block (L1) | 2.06% | 7.07% | 10.40% | 13.74% |
submitProof % of 300M block (L2) | 0.52% | 1.77% | 2.60% | 3.43% |
| Proving time, rapidsnark D5 (this host) | 3,461 ms | 14,429 ms | 15,686 ms | n/a * |
| Metric | N = 50 | N = 200 | N = 300 | N = 400 |
|---|---|---|---|---|
| Status | measured | measured | measured | projected |
| Circuit constraints (D6) | 2,201,594 | 8,711,660 | 13,038,566 | 17,365,472 |
submitProof gas (total) | 1,547,070 | 5,299,053 | 7,801,543 | 10,304,033 |
| Per-flow gas (÷N) | 30,941 | 26,495 | 26,005 | 25,760 |
| Verify gas / flow (÷N) | 4,739 | 1,185 | 790 | 592 |
| Marginal gas / row | — | 25,013 | 25,025 | 25,025 |
submitProof % of 75M block (L1) | 2.06% | 7.07% | 10.40% | 13.74% |
submitProof % of 300M block (L2) | 0.52% | 1.77% | 2.60% | 3.43% |
| Proving time, rapidsnark D6 (this host) | 3,507 ms | 13,644 ms | 18,110 ms | n/a * |
D6 adds ~34k–147k constraints over D5 at the same N (one extra Merkle level, ~519 constraints/row) — a ~1% circuit cost, and zero on-chain gas difference.
Applies to both depths (gas is depth-independent). How much each jump in N reduces per-flow gas:
| Step | Per-flow before → after | Gas saved / flow | % cheaper |
|---|---|---|---|
| N 50 → 200 | 30,941 → 26,495 | −4,446 | 14.4% |
| N 200 → 300 | 26,495 → 26,005 | −490 | 1.8% |
| N 300 → 400 | 26,005 → 25,760 | −245 | 0.9% |
The bigger batching win is not just amortizing the pairing check — it is avoiding the fixed
cost of creating another batch entirely. Every batch is one submitProof
transaction, and each transaction carries a fixed overhead independent of how many flows
it contains:
| Fixed per-batch component | Gas |
|---|---|
| EVM base transaction cost | 21,000 |
| Groth16 verify (pairing check, flat) | 236,939 |
| Dispatch + calldata base overhead | ~36,134 |
| Total fixed cost of one batch | ~294,073 |
So per-flow gas is really (fixed_batch_cost ÷ N) + fixed_row. Growing N spreads that
~294,073 "cost of a batch" over more flows — the more you batch, the more you avoid ever
creating (and paying for) another batch. But the second term — per-flow storage + calldata — is
untouchable.
| Metric | N = 200 | N = 300 | N = 400 | N = 500 |
|---|---|---|---|---|
| Fixed batch overhead / flow (÷N) — shrinks with N | 1,470 | 980 | 735 | 588 |
| of which: verify / flow | 1,185 | 790 | 592 | 474 |
| Storage + calldata floor / flow — never shrinks | ~25,025 | ~25,025 | ~25,025 | ~25,025 |
| Per-flow gas (total) | 26,495 | 26,005 | 25,760 | 25,613 |
| Marginal saving vs previous step | — | −1.8% | −0.9% | −0.6% |
At scale the batch-avoidance is the headline number. To settle 1,000,000 flows: at N=200 that is 5,000 batches × 294,073 = 1.47B gas of pure batch overhead; at N=500 it is only 2,000 batches = 0.59B — ~882M gas saved just by not creating 3,000 extra transactions.
N=500 not proved on this host. N=500 D6 (~21.7M constraints) needs a 2^26 FFT domain; local ptau reaches only 2^25. On-chain gas is projected from the measured flat-verify / constant-per-row model (reliable); proving time is left unquoted (2^25→2^26 jump breaks linear extrapolation).
* N=400 proving not measured on this host. N=400 D6 needs a 2^26 Groth16 FFT domain (~17.4M constraints × 2); local Powers-of-Tau only reaches 2^25 (pot25). The on-chain gas projection is reliable because verify is flat and per-row cost is constant and measured; only the proving time requires pot26 to measure and is left as n/a rather than guessed (the 2^25→2^26 domain jump makes linear proving-time extrapolation unreliable).
The routing telemetry mean is 9.3 hops per flow. That comfortably fits inside a D=4 tree (2^4 = 16 leaf slots → 16-hop max). Since the whitepaper lets each flow pick the smallest depth that fits its path, the typical flow can settle at D=4, reserving D=5/D=6 only for the longer tail (peak 18.5 needs D≥5; 64-hop worst case needs D=6).
A shallower tree is a cheaper circuit — one fewer Merkle level. From the measured D5→D6 delta, one level costs 490 constraints per settled row (~1.1%), so D=4 saves that much versus D=5:
| N | D=5 constraints | D=4 constraints (est) | Saved |
|---|---|---|---|
| 200 | 8,613,660 | 8,515,660 | 98,000 (1.1%) |
| 300 | 12,891,566 | 12,744,566 | 147,000 (1.1%) |
| 400 | 17,169,472 | 16,961,720 | 207,752 (1.2%) |
Constants (measured): verify 236,939 · verify/hop 1,185 (N=200) · cold 26,533 · warm 4,637 · FPC 4. Sources: v3-verify-matrix.csv, v3-breakdown.csv, v3-coldwarm.csv, v3-gas.csv, v3-rapidsnark-results.json (spacenetwork-billing-research/code-samples/b0001a/zk/proof-artifacts/). Whitepaper: SpaceNetwork Billing & Settlement, Nguyen/Lebée, Jun 2026 — §Flow identity, §Path Merkle tree.