ZKperps
One-click for Private Perpetuals
视频

技术栈
描述
zkperps is a privacy-preserving perpetual futures trading system built on Uniswap V4 hooks, designed to eliminate front-running, sandwich attacks, and MEV extraction in on-chain perps.
Core Innovation Traditional on-chain perpetuals expose individual trade intents (size, direction, leverage) in the public mempool or calldata, allowing MEV bots to front-run large positions, snipe liquidations, or sandwich trades — resulting in significant slippage, lost profits, and leaked strategies for users and autonomous agents.
zkperps fixes this with a commit-reveal + ZK-verified batch execution model:
Users (via a Next.js frontend) submit commitments (only hashes of their perp intents: e.g., open ETH/USD long 0.1 ETH at 10x leverage with specific margin).
Circom circuits generate Groth16 ZK proofs to verify commitment validity (sufficient collateral, valid parameters, no double-spend) without revealing details — proofs are checked on-chain.
A coordinator collects commitments, triggers reveals (in separate txs), and executes the batch: only the aggregate net delta (e.g., net +0.45 ETH long exposure across all participants) interacts with the Uniswap V4 AMM pool via the custom PrivBatchHook.
Individual positions are privately managed and updated in the PerpPositionManager contract — no single trade's size or direction is ever visible publicly.
Funding rates, margin calculations, liquidations, and mark prices are handled on-chain with an oracle adapter.
Tech Stack & Deployment
Frontend: Next.js + React Query + Privy (email login + embedded wallets) + Chart.js + CoinGecko for live ETH/USD pricing.
Backend: Express API for intent coordination, server-side signing, positions/collateral queries (minimizing user signatures).
Contracts (deployed on Base Sepolia):
PrivBatchHook: 0xe3ea87fb759c3206a9595048732eb6a6000700c4
PerpPositionManager: 0xf3c9cdbaf6dc303fe302fbf81465de0a057ccf5e
Mock USDC: 0x3cbe896e5e4093d6bf8dc0dc7a44c50552c0651e
Mock USDT: 0x3c604069c87256bbab9cc3ff678410275b156755
Market ID: 0x0000000000000000000000000000000000000001
ZK: Circom circuits + Groth16 proofs for commitment integrity.
Why It Matters This delivers true MEV resistance for perpetuals without requiring a custom L1 or off-chain order book — preserving full Ethereum/L2 composability while protecting traders from classic DeFi attacks. It enables fairer execution for retail users and profitable, stealthy operation for autonomous trading agents in a world where privacy is becoming essential.
Built during the hackathon using Uniswap V4's extensible hooks, zkperps pushes the boundaries of private DeFi execution and demonstrates how hooks can power sophisticated derivatives primitives securely and privately.
zkperps: Making on-chain perpetual futures private, protected, and production-ready.