Confidex Technical Documentation
Confidex is a confidential decentralized exchange implementing a two-layer privacy architecture using Arcium MPC for encrypted order matching and ShadowWire for private settlement. All order data (price, quantity, side, trader identity) is encrypted on-chain and only decrypted within the MPC cluster for matching.
Hackathon Prize Alignment
Two-Layer Privacy Architecture
Confidex uses Arcium MPC as the primary privacy layer - all order data (price, quantity, side, trader identity) is encrypted on-chain. ShadowWire provides private settlement with hidden transfer amounts. ZK eligibility proofs are available as an optional compliance layer for regulated use cases.
Compliance Layer (Noir ZK Proofs)
Prove eligibility without revealing identity
Uses Sparse Merkle Tree non-membership proofs - proves you're NOT on the blacklist without revealing who IS blacklisted.
Execution Layer (Arcium MPC)
Encrypted order matching preventing MEV
Order prices are encrypted before submission. MPC nodes compare encrypted prices without ever decrypting them - only the boolean match result is revealed.
Settlement Layer (ShadowWire / C-SPL)
Private token transfers and encrypted balances
ShadowWire enables private transfers where amounts are hidden via Bulletproof range proofs. C-SPL will provide fully encrypted on-chain balances.
Light Protocol (Infrastructure)
Cost OptimizationLight Protocol provides ZK Compression for rent-free token accounts, reducing storage costs by ~400x compared to regular SPL accounts. This is an infrastructure optimization, not a privacy layer - amounts remain visible on-chain.
ZK Compliance Layer
The eligibility circuit proves blacklist non-membership without revealing the user's address. This enables regulatory compliance (KYC/AML screening) while preserving user privacy.
// circuits/eligibility/src/main.nr
fn main(
// Public input - stored on-chain
blacklist_root: pub Field,
// Private inputs - never revealed
merkle_path: [Field; 20],
path_indices: [Field; 20]
) {
// Verify SMT non-membership by checking path leads to empty leaf
// The address is derived from path_indices, never passed directly
let valid = verify_smt_non_membership(
blacklist_root,
merkle_path,
path_indices
);
assert(valid, "Address is blacklisted or proof invalid");
// Proof passes = address NOT on blacklist
}ZK Infrastructure Status
The complete ZK proving infrastructure is built, tested, and operational. The backend service generates real Groth16 proofs using the following components:
Eligibility verification circuit with Poseidon2 hash and SMT depth 20
Generates Solana-compatible Groth16 proofs in 3-5 seconds
Deployed verifier program validates proofs during order placement
Proving/verification keys and compiled constraint system ready
MPC Execution Layer
Arcium's Multi-Party Computation enables encrypted order matching. Prices and amounts are encrypted before submission - the MPC cluster compares them without ever decrypting, preventing front-running and MEV extraction.
MXE Deployment Status (Live)
Spot Trading MXE
CJRUcrAFi764GHcPRg1e12Ymw7Nb2ZmrnFoW1k87XJMMfe955746fa98e3597086eaca87eb248c33de439ad23549c7cdb87b16d3baed72Perpetuals MXE
CSTs9KjTmnwu3Wg76kE49Mgud2GyAQeQjZ66zicTQKq99163f8e9c1ac55ead26717a6985f09366c46e629d7f1024319ad5f428b4682bfSupported MPC Operations
| Operation | Inputs | Output | Use Case |
|---|---|---|---|
| ComparePrices | 2x encrypted u64 | bool | Determine if orders match |
| CalculateFill | 4x encrypted amounts | encrypted + 2 bools | Calculate fill amount |
| VerifyPositionParams | encrypted collateral/size | bool | Perps position opening |
| BatchLiquidationCheck | up to 10 encrypted thresholds + mark | bool[10] | V2: Batch liquidation check |
| CalculatePnL | encrypted size/entry + price | u64 + is_loss bool | Close position / liquidation |
V2 Privacy Enhancements
entry ≈ threshold / 0.95[u8; 16] hashes instead of sequential u64, preventing activity correlationtimestamp / 3600 * 3600) reduces temporal correlation attacksis_matching flag for MPC trackingSettlement Layer
Settlement executes the final token transfers after MPC matching completes. We support multiple settlement providers with automatic fallback for maximum reliability.
ShadowWire
Bulletproof ZK proofs hide transfer amounts. 1% relayer fee. Supports 17+ tokens.
C-SPL
Twisted ElGamal encryption for fully encrypted on-chain balances with optional auditor access.
Standard SPL
Currently used for perpetual collateral transfers. Amounts visible on-chain until C-SPL SDK available.
V2 uses pure ciphertext with no plaintext prefix. All values are fully encrypted and only MPC can access them:
// 64-byte V2 pure ciphertext format
[nonce (16 bytes) | ciphertext (32 bytes) | ephemeral_pk (16 bytes)]
Bytes 0-15: Nonce → MPC decryption seed
Bytes 16-47: Ciphertext → Fully encrypted value
Bytes 48-63: Ephemeral pubkey → MPC key routing
// No plaintext prefix - complete privacyMPC handles all comparisons and calculations. Order amounts, prices, and liquidation thresholds are never visible on-chain.
Complete Data Flow
From order placement to settlement, here's how data flows through the three privacy layers:
Security Model & Privacy Guarantees
Privacy Guarantees Matrix (V2)
| Data | Visibility | Mechanism | Status |
|---|---|---|---|
| User Identity | Private | ZK eligibility proof | Full Privacy |
| Order Amounts/Prices | Private | V2 pure ciphertext (64 bytes) | Full Privacy |
| Price Comparison | Private | MPC Cerberus protocol | Full Privacy |
| Liquidation Thresholds | Private | MPC batch verification | Full Privacy |
| Position/Order IDs | Private | Hash-based (no sequential leak) | Full Privacy |
| Timestamps | Coarse | Hour precision only | Full Privacy |
| Order Status | Minimal | Active/Inactive only (2 states) | Full Privacy |
| Position Side/Leverage | Public | Required for funding/risk | Necessary |
| Collateral Amount | Public* | SPL token transfer (C-SPL pending) | Temporary |
| Settlement | Private | ShadowWire Bulletproofs | Full Privacy |
*Collateral uses standard SPL transfer as temporary fallback until C-SPL SDK is available
Threat Mitigations
Production Readiness
Confidex is production-ready for hackathon demo with real token movements, persistent settlement tracking, and live order book data from the chain.
Production Features (January 2026)
Frontend Hooks
| Hook | Purpose | Status |
|---|---|---|
| useOrderBook() | Real-time order book from chain (V5 orders) | Live |
| useRecentTrades() | Live trade feed from settlement events | Live |
| useMpcEvents() | MPC computation tracking and callbacks | Live |
| useEncryption() | Client-side RescueCipher encryption | Live |
| useSolPrice() | Pyth oracle price feed | Live |
The automated crank service provides production-grade order matching with SQLite persistence:
# Enable crank service
CRANK_ENABLED=true
# Production MPC (default is TRUE as of Jan 2026)
CRANK_USE_REAL_MPC=true
# Configuration
CRANK_POLLING_INTERVAL_MS=5000 # Check for matches every 5s
CRANK_USE_ASYNC_MPC=true # Production async MPC flow
CRANK_MAX_CONCURRENT_MATCHES=5 # Parallel match attempts
CRANK_DB_PATH=./data/crank.db # SQLite persistence
# Check crank status
curl http://localhost:3001/admin/crank/statusProgram IDs & Accounts
Devnet Program IDs
63bxUBrBd1W5drU5UMYWwAfkMX7Qr17AZiTrm3aqfArBCJRUcrAFi764GHcPRg1e12Ymw7Nb2ZmrnFoW1k87XJMMCSTs9KjTmnwu3Wg76kE49Mgud2GyAQeQjZ66zicTQKq99op573D8GuuMAL2btvsnGVo2am2nMJZ4Cjt2srAkiG9WArcj82pX7HxYKLR92qvgZUAd7vGS1k4hQvAFcPATFdEQLatest Deployment (January 2026)
- • Encrypted liquidation thresholds
- • Hash-based position IDs
- • Coarse timestamps (hour precision)
- • SPL collateral transfer (C-SPL pending)
- • Collateral amounts currently visible
- • Will use confidential_transfer when available
- • Encrypted collateral blob stored for future use
Frequently Asked Questions
Common questions about wallet warnings, privacy features, and trading on Confidex.
This warning is expected for Confidex transactions and does not mean your transaction will fail.
Confidex uses Arcium MPC (Multi-Party Computation) for encrypted order matching. MPC operations require actual network execution and cannot be simulated locally by your wallet.
Your transaction will succeed when submitted to the network.
Note: Wallet warnings about "simulation failed" are expected for privacy-preserving transactions. Your transactions will succeed when submitted.
Future Implementations
Confidex is continuously improving privacy coverage. These are planned enhancements that will further strengthen the privacy guarantees of the protocol.
Confidential Collateral for Perpetuals
High PriorityCurrently, perpetuals collateral transfers use standard SPL tokens, meaning collateral amounts are visible on-chain. This is a temporary fallback while the C-SPL (Confidential SPL) SDK for Rust programs is being finalized.
- • Collateral deposit amount (USDC)
- • Collateral withdrawal amount (USDC)
- • Margin add/remove amounts
- • Position size (encrypted)
- • Entry price (encrypted)
- • Liquidation thresholds (encrypted)
- • PnL calculations (MPC)
confidential_transfer. Once the Rust SDK is available, perpetuals will use the same encrypted trading balance as spot trading.Multi-Asset Perpetuals
PlannedSupport for additional perpetual markets beyond SOL-PERP, including BTC-PERP, ETH-PERP, and other major assets with encrypted position management.
Cross-Margin with MPC
PlannedCross-margin mode where multiple positions share collateral. MPC will handle encrypted aggregate margin calculations without revealing individual position details.
Batch Liquidation Optimization
In ProgressThe batch_liquidation_check circuit is currently disabled due to high ACU cost (~4.2B per position). Working on optimizing the circuit to enable efficient batch checking of up to 10 positions per MPC call.
Private Trade History
PlannedEncrypted trade history stored off-chain with client-side decryption. Users will be able to view their complete trading history privately without exposing it on-chain.
Optional Auditor Access
PlannedSelective disclosure feature allowing users to grant read access to auditors or regulators for specific positions. Uses re-encryption to share data without revealing master keys.