Skip to content

v1.1.0 — Merkle batch settlement proofs

Choose a tag to compare

@vergex402 vergex402 released this 27 Sep 14:58
· 11 commits to main since this release

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 batch

No 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 wallet
  • verify_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.

Live: https://vergesnowy.com/api/proofs?latest=true