project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

CipherPool

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

CipherPool

Created At

ETHGlobal Bangkok

Winner of

Lit Protocol - Best Use of Lit Protocol 1st place

Project Description

Traders who deal with large token swaps on decentralized exchanges (DEXes) often face three major challenges:

  1. 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.

  2. 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.

  3. 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:

  1. Privacy-First Orders: Traders encrypt their order details (such as amounts) directly on their devices using the Lit Protocol.
  2. Encrypted Order Book: CipherPool maintains a secure, encrypted order book and runs a matching engine to pair compatible buy and sell orders.
  3. 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.

How it's Made

The project leverages the Lit Protocol at its core to encrypt and manage order matching. Here's how it works:

  1. 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.

  2. 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.

background image mobile

Join the mailing list

Get the latest news and updates