CipherPool
A Dark pool for P2P trading of erc20 tokens which ensures zero slippage/price impact and complete privacy of orders.
Screenshots






Problem Statement
Traders who deal with large token swaps on decentralized exchanges (DEXes) often face three major challenges:Frontrunning and Sandwich Attacks: When traders execute large token swaps using public RPC endpoints, they risk getting front-run by MEV (Maximal Extractable Value) bots. These bots monitor public mempools for profitable opportunities and often exploit large trades for gains, leaving traders at a disadvantage.Price Impact: Swapping large amounts of tokens in pools with low liquidity often results in significant price impact, meaning traders get worse rates as their trades affect the token's market price.Slippage: In highly volatile market conditions, traders often face a difference between the price they expect and the price at which their order actually executes, leading to unexpected losses.To solve these issues, we’ve built CipherPool, a dark pool for peer-to-peer (P2P) trading of ERC-20 tokens. Here's how it works:Privacy-First Orders: Traders encrypt their order details (such as amounts) directly on their devices using the Lit Protocol.Encrypted Order Book: CipherPool maintains a secure, encrypted order book and runs a matching engine to pair compatible buy and sell orders.On-Chain Settlement: Once orders are matched, the trades are executed and settled on-chain, transferring tokens directly between peers without exposing sensitive trade details.
Solution
The project leverages the Lit Protocol at its core to encrypt and manage order matching. Here's how it works:Session Signatures for Encryption: Each trader or client connects to the Lit network and obtains session signatures (session sigs). These signatures are then used to encrypt their orders securely.Defining Decryption Conditions: During encryption, specific conditions for decrypting the orders are set. In this case:The orders can only be decrypted by the user who created them. Alternatively, the orders can be decrypted within a Lit Action associated with a specific IPFS CID. Encrypted Order Submission: Once encrypted on the client side, the orders are sent to CipherPool, which maintains an encrypted order book.Matching Engine with PKP Ownership: CipherPool's matching engine includes a Programmable Key Pair (PKP), which also owns the vault contract. This PKP is responsible for signing all settlement transactions.Order Matching and Settlement: The Lit Action decrypts pairs of orders and checks if they match. If a match is found, the Lit Action generates a signed settlement transaction. The matching engine then submits this transaction on-chain, finalizing the trade.
Hackathon
ETHGlobal Bangkok
2024
Prizes
- 🏆
Best Use of Lit Protocol1st place
Lit Protocol
Contributors
- ciphernova-ship-it
27 contributions
- aryanTriremenTrading
18 contributions