Gas Consumption
Gas Consumption
Comparative Gas Analysis vs StarkEx, zkSync, Aztec Connect
Gas efficiency is a core constraint when deploying zero-knowledge infrastructure on-chain. For SnarkSide, minimizing gas cost while retaining full privacy, composability, and verifiability has driven circuit optimizations at every level—proof size, public inputs, calldata shape, and verifier logic. Unlike many L2 systems that roll up thousands of transactions with tradeoffs in latency or expressiveness, SnarkSide executes fully private, stateful perp trades with ZK-backed correctness per match, per vault, per settlement.
This section provides a breakdown of SnarkSide’s gas consumption per operation and compares it to similarly scoped or adjacent ZK-based systems—namely StarkEx, zkSync Era, and Aztec Connect. We also outline the strategic decisions that led to SnarkSide's current Groth16 deployment model and its upgrade path toward recursive ZK verification.
Baseline Gas Metrics (SnarkSide v1 - Groth16)
All measurements taken on Ethereum L2 with EVM parity (e.g., Arbitrum, Base, Linea).
ZK Proof Verification
410,000–480,000
Depends on circuit (intent/vault/oracle)
Vault UTXO Update
50,000
Poseidon hash, Merkle root re-commitment
Intent Settlement Tx
520,000–680,000
Includes calldata, proof, and state transitions
Liquidation Trigger
~540,000
ZK proof + vault nullifier + funding oracle check
Oracle Update (batched)
~330,000
For 8–16 prices via Merkle root, commit-reveal
Average Total Gas per Trade (Single Match):
~640,000–710,000 gas (Including one Groth16 verification, UTXO movement, oracle access)
With calldata compression and zk proof batching, total gas per verified match pair drops significantly when amortized.
Gas Optimization Techniques Used
Poseidon over SHA256 for all hash operations
Flattened witnesses, minimal public inputs (≤6)
No branching in circuit logic (uses constraint selectors instead)
Compressed calldata using preprocessed field element packing
Verifier circuit split (intent, vault, oracle) to keep logic atomic
Comparative Table (Trade-Level Operations)
SnarkSide
Groth16
480k–710k
4–6
Private perps, vault UTXO
StarkEx (dYdX)
STARK
350k (amortized)
N/A (batch proofs)
Batch-size ~1024–2048 tx
zkSync Era
PLONK + custom
~400k (per tx est.)
10+ (EVM translation)
No native private state
Aztec Connect
PLONK
~650k–800k
8–10
Private bridge, not perps
Notes:
StarkEx achieves high efficiency via mass batching and centralized prover model, but lacks on-chain vault transparency and general privacy per trade.
zkSync targets generic EVM compatibility; lacks encrypted vaults or liquidation-proof systems.
Aztec Connect supports shielded DeFi but lacks native perps, UTXO margin, or intent-based settlement.
SnarkSide prioritizes trustless, shielded state transitions—trading slight gas inefficiency for full privacy and MEV resistance.
Breakdown: Intent Settlement Example
Transaction: Encrypted Perp Match Settlement
- calldata: 220 bytes (compressed proof + 5 public inputs)
- ZK verifier cost: 440,000 gas
- Vault state update: 65,000 gas
- Oracle access + validation: 35,000 gas
- Total: ≈ 690,000 gas→ For 12 matched intents in a batch, amortized cost drops to ~110,000–140,000 gas per trade
L2 Strategy & Future Compression
SnarkSide will deploy primarily on ZK-native L2s with:
Verifier precompiles (e.g., StarkNet, Scroll)
calldata compression (e.g., blob/rollup lanes)
account abstraction for stealth wallet orchestration
dynamic fee markets (to offset ZK latency)
Upgrade Path:
v1 (Live)
Groth16
~680k
v2
Groth16 + Recursive Aggregation
~320k
v3
Halo2
~200k (batch recursive)
v4
zkVM
TBD (intent DSL)
Summary
SnarkSide proves that fully private perp execution with margin logic can be deployed on-chain within gas budgets of sub-700k—competitive with existing transparent DEXs, and far more secure for high-sensitivity traders.
Through constraint minimization, calldata optimization, and eventual recursive folding, SnarkSide will continue to push ZK privacy into production-grade latency and gas bounds, enabling the first truly encrypted, institution-ready perpetual exchange.
Last updated

