Skip to content

SemiuAdesina/cipherpool

Repository files navigation

CipherPool

Encrypted Dark Pool Batch Auctions on Solana

I built CipherPool to solve a problem I noticed in DeFi - everyone can see your trades before they execute. This creates MEV opportunities and makes institutional trading nearly impossible. My solution: encrypt the entire orderflow using Arcium's MPC network, run batch auctions where nobody sees individual orders, and settle everything trustlessly on Solana.

What I'm Building

I'm combining Arcium's encrypted compute with Solana to create a dark pool where your orders stay private. Submit encrypted orders, Arcium computes the clearing price without seeing individual trades, and everyone settles at the same fair price. No front-running, no MEV, just fair execution.

Architecture

┌─────────────┐
│   Client    │ Encrypts orders locally with Arcium SDK
│  (React)    │
└──────┬──────┘
       │
       ▼
┌─────────────┐
│   Flask     │ Order management, notifications, metrics
│   Backend   │
└──────┬──────┘
       │
       ▼
┌─────────────┐
│   Solana    │ Stores encrypted orders, queues Arcium jobs
│   Program   │ Receives callbacks, settles batches
└──────┬──────┘
       │
       ▼
┌─────────────┐
│   Arcium    │ Executes encrypted clearing function (MPC)
│   Compute   │ Returns clearing price + fills
└─────────────┘

Privacy Benefits

  • Orders Stay Private: All order details (side, quantity, price) encrypted end-to-end
  • MEV Resistance: No front-running possible when orders are encrypted
  • Fair Execution: Uniform clearing price computed over encrypted data
  • Selective Reveal: Only clearing price and your fills visible to you
  • On-Chain Settlement: Trustless settlement on Solana with cryptographic proofs

Features

  • Encrypted Order Submission: Client-side encryption using Arcium InputValues
  • Batch Auctions: Fixed-duration epochs (e.g., every 30 blocks)
  • MPC Clearing: Walrasian auction clearing over fully encrypted orderflow
  • Callback Settlement: Arcium returns results to Solana program for trustless settlement
  • Real-time UI: React frontend with wallet adapter and live auction status
  • Token Escrow: SPL token deposits held securely during auction

Project Structure

cipherpool/
├── frontend/             # React + Next.js frontend
├── backend/              # Flask API
├── chain/
│   └── programs/
│       └── cipherpool/   # Anchor Solana program
├── arcium/
│   └── functions/        # Encrypted compute functions
├── packages/
│   └── sdk/              # Shared TypeScript types
├── docs/                 # Architecture & privacy docs
└── scripts/              # Deployment & testing scripts

Tech Stack

  • Frontend: Next.js 14, React, TypeScript, Tailwind CSS, @solana/wallet-adapter
  • Backend: Flask, Python 3.11+
  • Blockchain: Solana (Anchor framework), SPL Token
  • Encrypted Compute: Arcium Phase 2 Testnet SDK (@arcium-hq/client)
  • Encryption: RescueCipher with x25519 Diffie-Hellman key exchange
  • MPC Framework: Arcis for encrypted instructions
  • Testing: Jest, Pytest, Anchor tests

Quick Start

Prerequisites

# Node.js 18+
node --version

# Python 3.11+
python3 --version

# Solana CLI
solana --version

# Anchor 0.28+
anchor --version

# Rust toolchain
rustc --version

Setup

# Clone and install
git clone https://github.com/SemiuAdesina/cipherpool.git
cd cipherpool
npm install

# Set up Solana Devnet
solana config set --url https://api.devnet.solana.com
solana-keygen new

# Set up Arcium Testnet
# Follow: https://www.arcium.com/testnet

# Build Anchor program
cd chain
anchor build
anchor deploy

# Start Flask backend
cd backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
flask run

# Start Next.js frontend
cd frontend
npm install
npm run dev

Open http://localhost:3000

Documentation

How It Works

1. Place Order (Encrypted)

// Client encrypts order locally
const encrypted = await arciumClient.encrypt({
  side: 'buy',
  qty: 100,
  limitBps: 10050  // $1.005
});

// Submit to Solana program
await program.methods.placeOrder(encrypted)
  .accounts({ auction, order, escrow })
  .rpc();

2. Close Auction (Queue Arcium Job)

// Anchor program queues encrypted computation
let job_id = arcium::queue(
    "clearing_price_v1",
    encrypted_orders,
    callback_ix
)?;
auction.status = Computing;

3. Arcium Computes (MPC)

// Runs in encrypted environment
fn clearing_price(orders: Vec<EncryptedOrder>) -> ClearingResult {
    let (price, fills) = compute_walrasian_clearing(orders);
    ClearingResult { price, fills }
}

4. Settlement (Callback)

// Arcium calls back to Solana program
#[arcium_callback]
pub fn apply_clearing_result(result: EncryptedResult) {
    arcium::verify(&result)?;
    auction.clearing_price = result.price;
    // Settle SPL token transfers
}

Hackathon Submission

Track: Arcium - Encrypt Everything
Category: Dark Pools / Private Trading
Timeline: October 9 - October 30, 2025

Judging Criteria Alignment

  • Innovation: First encrypted batch auction on Solana with selective reveal
  • Technical: Full Solana-Arcium orchestration with callback pattern
  • Impact: MEV resistance for institutional DeFi adoption
  • Clarity: Comprehensive docs explaining privacy model

Resources

License

MIT

Contributing

Built for Arcium x Colosseum Cypherpunk Hackathon 2025


Contact: For private repo access: arihant@arcium.com

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors