System design and architecture specification for a MEV-resistant, private decentralized exchange on Sui.
Public AMMs face two main issues:
- MEV & Front-running: Public mempools allow sandwich attacks.
- State Contention: Global pool updates block parallel execution.
This design solves both using:
- Move Object Model: Owned objects for user positions (parallel path), Shared objects for liquidity pools.
- Programmable Transaction Blocks (PTB): Bundles price verification, swaps, and slippage checks into an atomic unit.
- ZK Dark Pool Layer: Validates order parameters off-chain using ZK proofs.
flowchart TD
subgraph L1 ["1. Client & SDK Layer"]
direction TB
A["Frontend App"] --> B["Sui SDK (PTB Builder)"]
B --> C1["1. Verify Oracle Price"]
B --> C2["2. Execute Swap"]
end
subgraph L2 ["2. Execution Layer"]
direction TB
D["Atomic PTB Validation"] --> E["Parallel Execution Scheduler"]
end
subgraph L3 ["3. Move Smart Contracts"]
direction TB
F["LiquidityPool (Shared)"]
G["UserPosition (Owned)"]
H["ZK Verifier Contract"]
end
L1 --> L2 --> L3
E --> F & G & H
Builds Programmable Transaction Blocks (PTBs):
- Enforces price and slippage checks before swap execution.
- If any check fails, the entire transaction block reverts.
| Object Type | Role | Consensus |
|---|---|---|
| Shared Objects | Pools & Orderbook | Full Consensus |
| Owned Objects | User Positions & Tokens | Parallel Fast Path |
Off-chain prover verifies 6 constraints:
- AMM Invariant:
(x · fee_den + Δx · fee_num)(y − Δy) ≥ xy · fee_den - Slippage Guard:
Δy ≥ min_output - Pool Solvency:
y > Δy - Commitment:
Poseidon(secret, salt) == input_commitment - Nullifier:
Poseidon(secret) == nullifier_hash - Merkle Inclusion:
MerkleRoot(Poseidon(x, y)) == pool_state_root(depth 20)
- Trader computes proof off-chain.
- Client packages proof and PTB commands.
- Network verifies proof, updates pool state, and outputs tokens to user position.