Trade Matching Throughput

Trade Matching Throughput

Average Relayer Cycle Time (ms) • Max Intents per Batch with Proof Constraints


SnarkSide’s core engine—DarkMatch—is optimized for ultra-low latency, off-chain intent aggregation, and zk-verified trade settlement with on-chain finality. Unlike traditional orderbooks, DarkMatch executes encrypted user intents in a fully private, intent-matching pipeline where no party can observe or predict order flows prior to execution.

This section provides detailed performance metrics for the trade-matching pipeline, focusing on:

  • Relayer batch cycles

  • Proof generation latency

  • Throughput under real constraints

  • Scalability limits imposed by zk proving

All data was collected from live simulations and testnet deployments using reference hardware (see hardware profile at end).


Matching Pipeline Recap

  1. Intent Submission (Client → Relayer)

    • Encrypted trade intent sent over P2P or relay network

    • Includes nullifier, collateral, size, direction, timestamp

  2. Off-chain Matching Engine (DarkMatch)

    • Gathers compatible intents into symmetric bidirectional pairs

    • Applies funding, oracle delay window, margin rules

    • Matches sealed intents, generates match commitments

  3. Batch SNARK Proof Generation

    • Circuit proves:

      • Intent validity

      • Symmetry (Buy == Sell)

      • Margin bounds satisfied

      • No replay or nullifier reuse

      • Oracle epoch match

  4. On-chain Settlement

    • Proof + calldata submitted to IntentVerifier

    • Vault states updated (or created)

    • Positions opened under ZK-encrypted vault UTXOs


Average Relayer Cycle Time

Stage
Time (avg)
Notes

Intent Reception (network)

4–12 ms

Encrypted gRPC / libp2p

Matching Logic (off-chain)

7–21 ms

2–8 intents, memory-optimized tree

Proof Generation (Groth16)

740–960 ms

Per match-pair (unbatched)

Proof Generation (Batch)

1.7–2.2 s

8–12 pairs, witness flattening enabled

Transaction Submit (EVM)

1 block

Depends on chain; assumes L2 finality

End-to-end match execution latency: ~2.3s → User-facing intent response time: ~<50ms (pre-match state)


Max Intents per Batch

SnarkSide’s circuit design places hard constraints on how many encrypted intents can be provably matched in one batch proof. This is governed by:

  • Witness size (e.g. 2–3MB max)

  • R1CS constraint bounds (~250k–400k)

  • Public input gas cost

  • Prover RAM overhead

Current Benchmark (Groth16):

  • Max intents: 24 (12 matches)

  • Avg constraint count: 310,000

  • Proof size: ~230 bytes

  • Verifier gas cost: ~560,000

With Recursive Proofs (Halo2, WIP):

  • Targeted batching: 64–128 intents

  • Recursive folding across match blocks

  • Compression of 3–4 layers into a single zk proof

  • Expected verification cost: constant


Comparison to Traditional DEX Matching

Metric
Orderbook DEX (e.g. dYdX v3)
SnarkSide (DarkMatch)

Intent Visibility

Public

Encrypted

Matching

On-chain / sequencer

Off-chain, zk-verified

Front-running Risk

High

None

Max Orders per Block

Unbounded

zk-bounded (12–24 intents)

MEV Protection

None

Full

Latency (1 trade)

200ms (off-chain match)

~2.3s (with proof)

Latency (batched)

Varies

2–4s (batch of 8–12)

Tradeoff: Privacy and trustlessness at the cost of short latency overhead. Recursive SNARKs reduce this amortized gap over time.


Hardware Benchmark Environment

  • CPU: Intel i9-13900K (24-core, 5.8GHz)

  • RAM: 64GB DDR5

  • GPU: Not used (CPU-only proving)

  • OS: Ubuntu 22.04

  • Prover: SnarkJS (Groth16, WASM backend)

  • Node runtime: Node.js v18 LTS

  • Matching Engine: Rust-native, multithreaded


Future Optimizations

Optimization
Description
ETA

Recursive SNARK batching

Match/Settle/Oracle combined in 1 proof

Q4 2025

Native GPU Prover

Rust + CUDA witness generation

Q3 2025

Layered intent netting

Collapse multiple partial fills into net pair

Q2 2025

zkVM Integration (RISC-ZK)

Treat entire matching logic as zkVM program

2026+


Summary

SnarkSide’s trade matching architecture delivers highly efficient, fully encrypted intent settlement, achieving:

  • <1s matching latency per pair

  • ~2.2s batch execution time for 12 matches

  • 24-intent batch throughput under Groth16

  • Recursive SNARK upgrade path for >100 intents

This places SnarkSide at the frontier of private, scalable perp trading, enabling institutional-grade execution privacy without compromising verifiability or on-chain integrity.

Last updated