v1.1.0 — Merkle batch settlement proofs
v1.1.0 — Merkle Batch Settlement Proofs
Tamper-evident settlement history. Anyone can verify any payment was in a batch — cryptographically, without trusting Verge.
How it works
POST /api/proofs
→ picks up all unbatched settlements
→ builds SHA3-256 Merkle tree (commutative sorted pairs)
→ stores root in proof_batches table
→ returns { batchId, merkleRoot, leafCount }
GET /api/proofs?batch=<id>&settle=<logId>
→ returns { leaf, proof: string[], merkleRoot }
→ verify offline in 5 lines of JS (see below)
Verify any settlement offline
import { createHash } from "node:crypto";
function keccak(a, b) {
const [x, y] = a < b ? [a, b] : [b, a]; // commutative sort
return createHash("sha3-256").update(x + y).digest("hex");
}
function verify(leaf, proof, root) {
return proof.reduce(keccak, leaf) === root;
}
// From GET /api/proofs?batch=batch_xxx&settle=42:
verify(leaf, proof, merkleRoot); // true = settlement is in batchNo Verge server needed to verify. No trust required. The Merkle path is the proof.
Leaf encoding
SHA3-256( "<id>:<wallet>:<payer>:<amount>:<settledAt>" )
Anyone with access to the raw payments_log data can reconstruct every leaf and verify the root independently.
New endpoints
| Endpoint | Auth | Description |
|---|---|---|
POST /api/proofs |
Wallet cookie | Generate batch over new settlements |
GET /api/proofs |
Wallet cookie | List your batches |
GET /api/proofs?batch=<id> |
Public | Fetch batch metadata + root |
GET /api/proofs?batch=<id>&settle=<logId> |
Public | Get Merkle path for a settlement |
GET /api/proofs?latest=true |
Public | Latest batch root |
MCP tools (2 new)
generate_batch_proof— returns latest batch root for a walletverify_settlement— returns Merkle path for a specific settlement
Console
New Batch Proofs tab under Revenue in /app:
- One-click batch generation
- Merkle root display
- Inspect link per batch
Note on ZK: this ships Merkle batch proofs today (same pattern as Optimism/zkSync batch commitment). True ZK-SNARK proofs (Groth16/PLONK circuit over the batch) are the Q1 2027 upgrade path — the Merkle root is the public input the ZK circuit would prove over.