perpX
A private Solana perp DEX built with Arcium & ZEC.
Created on 4th December 2025
•
perpX
A private Solana perp DEX built with Arcium & ZEC.
The problem perpX solves
- No privacy in DeFi trading
- On most DEXes, everyone can see your position size, leverage, collateral, and PnL.
- This leads to:
- Front-running
- Competitors copying your strategy
- Loss of financial privacy
- PerpX fixes this using Arcium MPC, which encrypts all position data so only the trader can see it.
- No private way to move ZEC → Solana
- Today, ZEC holders must use centralized exchanges or transparent bridges.
- This reveals:
- Your identity (KYC exchange)
- Your Zcash address
- Your Solana trading wallet
- PerpX solves this with a private Zcash → Solana bridge:
- Users deposit ZEC via shielded transactions.
- Bridge mints wZEC on Solana.
- The link between identity and trading wallet is removed.
- High fees and slow transactions on other chains
- Ethereum-based perp DEXs have:
- Very high gas fees
- Slow confirmation times
- PerpX solves this by using Solana:
- Sub-second trades
- Fees under $0.001
- Smooth experience for active and high-frequency traders
- Ethereum-based perp DEXs have:
- Centralized exchange risks
- CEXs can freeze funds, get hacked, or shut down.
- Users don’t have real control over their crypto.
- PerpX solves this by being fully decentralized and non-custodial.
What People Can Use It For (How It Makes Things Easier & Safer)
-
Private perpetual trading
- Trade BTC, ETH, and SOL perps with up to 20x leverage.
- Positions, collateral, leverage, and PnL stay fully encrypted using Arcium.
- Prevents front-running and protects trading strategies.
-
Private ZEC → wZEC bridging
- Bridge ZEC to Solana without exposing your wallet or identity.
- Uses Zcash shielded addresses for both deposits and withdrawals.
- Complete privacy from start to finish.
-
Safer execution for institutions & pro traders
- Large positions stay hidden.
- Competitors cannot track or copy trading activity.
- Eliminates market impact and slippage caused by visible orders.
-
Privacy for everyday users
- Retail users can trade without showing their portfolio or risk profile on-chain.
- No KYC required.
-
Low-cost, fast trading experience
- Near-zero fees and instant transactions.
- Feels like a CEX but with full privacy and self-custody.
In simple words:
PerpX lets users privately bridge ZEC to Solana and trade perpetuals with encrypted positions, low fees, and full self-custody, making trading safer, faster, and completely private.
Challenges I ran into
1. Handling Encrypted Position Data With Arcium
The challenge:
When I first integrated Arcium MPC, the decrypted values for position size were coming back as huge unusable numbers. This broke fee calculations and prevented users from closing positions because the system thought they owed massive fees.
How I solved it:
- Added validation to detect corrupted or invalid decrypted values
- Calculated position size using known values (collateral, leverage, ZEC price) as a fallback
- Added sanity checks to cap fees and PnL for safety
This made encrypted computation reliable and allowed positions to close correctly.
2. USD (6 decimals) vs wZEC (8 decimals) Unit Mismatch
The challenge:
PnL was calculated in USD but collateral was in wZEC. Mixing these units caused wrong payouts and users losing collateral after closing positions.
How I solved it:
- Introduced
zec_price
into all relevant calculations - Explicitly converted every value between USD ↔ wZEC
- Updated both frontend and program logic to maintain consistent units
After fixing this, payouts and margin checks became accurate.
3. Zcash Node Sync & RPC Issues for the Private Bridge
The challenge:
The first Zcash Docker image I used was outdated and never synced. RPC calls also failed due to authentication issues, blocking the entire private ZEC → wZEC bridge flow.
How I solved it:
- Switched to the official
electriccoinco/zcashd
image - Fixed RPC settings and added proper authentication
- Added error-handling for import/viewing key issues
- Ensured the relayer can reliably detect shielded deposits
This made the private bridge stable and testable.
4. Anchor & TypeScript Type Errors
The challenge:
Anchor types were causing deep instantiation errors and the Arcium client imports behaved differently across environments.
How I solved it:
- Used
as any
where Anchor types became too complex - Added proper
BufferSource
casting for crypto operations - Used dynamic imports for Arcium client packages
This unblocked development and kept the codebase maintainable.
5. Position Reuse Issues
The challenge:
Users couldn’t open a second position because Anchor accounts were created with
init
, which only works once.How I solved it:
- Replaced
init
withinit_if_needed
- Added logic to reuse inactive position accounts
This allowed seamless opening/closing of multiple positions.
Summary
Most challenges came from combining three complex systems:
- Encrypted computation (Arcium MPC)
- Cross-chain shielded deposits (Zcash → Solana)
- High-performance on-chain logic (Solana/Anchor)
Solving these forced me to build reliable fallbacks, strict unit-handling, improved error logging, and a much more robust architecture overall.
Tracks Applied (4)
Private DeFi & Trading
Arcium
Cross-Chain Privacy Solutions
Pump Fun
Cross-Chain Privacy Solutions
Helius
Private DeFi & Trading
Zcash Community Grants
Technologies used
Cheer Project
Cheering for a project means supporting a project you like with as little as 0.0025 ETH. Right now, you can Cheer using ETH on Arbitrum, Optimism and Base.
