Trade Big. Stay Invisible.
Every on-chain OTC trade today leaks information before settlement:
- Sellers broadcast their intent โ MEV bots front-run immediately
- Buyers reveal their price โ competitors undercut them
- The entire deal lives in the public mempool before execution
VeilDEX.so solves this with a 3-layer privacy stack powered by MagicBlock PER + Intel TDX.
graph TB
subgraph UI["๐ฅ๏ธ VeilDEX.so Frontend โ Next.js 14"]
A[Seller Wallet]
B[Buyer Wallet]
end
subgraph SOLANA["โ๏ธ Solana L1 โ Public Layer"]
C["VeilDEX Anchor Program\n3pH9Tr8dfwTyYiKSskxsyRrPdQUXWdBX75M5ARr9bB5x"]
D["Deal PDA\ndeal_id ยท token_pair ยท expiry ยท bid_count ยท status"]
E["SPL Escrow Vault\nTokens Locked Here"]
F["Settlement Record\nWinner ยท Timestamp โ post-settle only"]
end
subgraph PER["๐ MagicBlock PER โ Privacy Layer"]
G["OfferTerms Account\namount_offered ยท min_price\nโ ๏ธ Seller-only read via TEE auth"]
H["BidTerms Account\nbid_amount_sol\nโ ๏ธ Buyer-only read via TEE auth"]
I["EATA Delegation\nEphemeral ATA Lifecycle"]
end
subgraph TEE["๐ก๏ธ Intel TDX Enclave โ Hardware Layer"]
J["TEE Auth Engine\ngetAuthToken()"]
K["Blind Matching Logic\nbest_bid โฅ min_price?"]
L["TDX Attestation\nverifyTeeRpcIntegrity()"]
end
A -->|"1. createDeal\npublic metadata only"| C
A -->|"2. Lock tokens in escrow"| E
A -->|"3. Encrypt offer terms\nTEE-gated"| G
B -->|"4. submitBid\nbid_count +1 only"| D
B -->|"5. Encrypt bid amount\nTEE-gated"| H
J -->|"Issues auth tokens"| G
J -->|"Issues auth tokens"| H
K -->|"Reads OfferTerms"| G
K -->|"Reads all BidTerms"| H
K -->|"6. settleDeal\nAtomic SPL swap"| C
K -->|"Tokens to winner"| E
L -->|"On-chain attestation"| C
C --> D
C --> F
style SOLANA fill:#0f172a,stroke:#a78bfa,color:#f0eeff
style PER fill:#1e1b4b,stroke:#6d28d9,color:#f0eeff
style TEE fill:#1a1a2e,stroke:#0891b2,color:#f0eeff
style UI fill:#0a0a14,stroke:#374151,color:#f0eeff
sequenceDiagram
participant S as ๐ฆ Seller
participant UI as VeilDEX.so
participant TEE as Intel TDX
participant PER as MagicBlock PER
participant SOL as Solana L1
Note over S,SOL: โโ Phase 1 โ TEE Authentication โโ
S->>TEE: signMessage(wallet.publicKey)
TEE-->>S: authToken (hardware-attested)
S->>TEE: verifyTeeRpcIntegrity()
TEE-->>UI: โ
TDX Verified Badge shown
Note over S,SOL: โโ Phase 2 โ Create Private Offer โโ
S->>SOL: createDeal(deal_id, expiry) via Anchor
SOL-->>S: โ
Deal PDA โ public: ID + expiry only
S->>SOL: transferToVaultIx โ tokens locked
SOL-->>S: โ
Tokens in escrow vault
S->>PER: store OfferTerms {amount, min_price}
PER-->>S: โ
Encrypted โ seller-only read
Note over S,SOL: โโ Phase 3 โ Buyer Submits Blind Bid โโ
participant B as ๐ค Buyer
B->>TEE: signMessage(wallet.publicKey)
TEE-->>B: authToken
B->>UI: Sees deal โ token_pair + expiry + โโโโโโโโ amounts
B->>SOL: submitBid(deal_id) via Anchor
SOL-->>B: โ
bid_count +1 only โ no amount on-chain
B->>PER: store BidTerms {bid_amount_sol}
PER-->>B: โ
Encrypted โ buyer-only read
Note over S,SOL: โโ Phase 4 โ TEE Settlement โโ
S->>TEE: trigger settleDeal(deal_id)
TEE->>PER: read OfferTerms via seller auth
TEE->>PER: read all BidTerms via TEE auth
TEE->>TEE: match โ best_bid โฅ amount ร min_price?
TEE->>SOL: settleDeal(winner, amount_tokens) via Anchor
SOL->>SOL: SPL transfer โ escrow โ winner ATA
SOL->>SOL: SOL transfer โ bid escrow โ seller
SOL-->>UI: โ
Deal.status = Settled
UI-->>S: ๐ Settlement Reveal โ amounts unveiled!
UI-->>B: ๐ Tokens in wallet!
graph LR
subgraph PUBLIC["โ
PUBLIC โ Solana On-Chain Always"]
P1[Deal ID]
P2[Token Pair]
P3[Expiry Timestamp]
P4[Bid Count]
P5[Settlement Winner]
P6[Settlement Timestamp]
end
subgraph PRIVATE["๐ PRIVATE โ MagicBlock PER / TEE Only"]
R1["Offer Amount\nSeller-only read"]
R2["Min Price per Token\nSeller-only read"]
R3["Each Bid Amount SOL\nBuyer-only read"]
R4["Matching Logic\nOperator-blind TEE"]
end
subgraph REVEAL["โก REVEALED โ Post-Settlement Only"]
V1[Final Amounts]
V2[Clearing Price]
V3[Winner Identity]
end
PRIVATE -->|"Atomic settlement\ncommits to Solana"| REVEAL
PUBLIC --> REVEAL
style PUBLIC fill:#064e3b,stroke:#22c55e,color:#f0eeff
style PRIVATE fill:#1e1b4b,stroke:#a78bfa,color:#f0eeff
style REVEAL fill:#7c2d12,stroke:#f59e0b,color:#f0eeff
| Layer | Technology | Purpose |
|---|---|---|
| Smart Contract | Anchor 0.30.1 + Rust | Deal lifecycle, escrow, atomic settlement |
| Blockchain | Solana Devnet | Settlement layer, SPL token transfers |
| Privacy Layer | MagicBlock Private Ephemeral Rollups | Encrypted per-user state |
| TEE | Intel TDX via MagicBlock | Hardware-attested blind matching |
| Frontend | Next.js 14 App Router | Dark pool trading dashboard |
| Wallet | Phantom + Solflare | Transaction signing |
| SDK | @magicblock-labs/ephemeral-rollups-sdk |
PER + TEE integration |
| UI | Tailwind CSS + shadcn/ui | Dark theme components |
// TEE Auth & Verification
getAuthToken(EPHEMERAL_RPC_URL, wallet.publicKey, signMessage)
verifyTeeRpcIntegrity(EPHEMERAL_RPC_URL)
// Vault + Token Management
initVaultIx(vault, tokenMint, payer, vaultBump)
initVaultAtaIx(payer, vaultAta, vault, tokenMint)
transferToVaultIx(eata, vault, tokenMint, userAta, vaultAta, payer, amount)
// PER EATA Lifecycle
deriveEphemeralAta(user, tokenMint)
deriveVault(tokenMint)
initEphemeralAtaIx(eata, user, tokenMint, payer, eataBump)
createEataPermissionIx(eata, payer, eataBump)
delegateEataPermissionIx(payer, eata, eataBump, VALIDATOR_PUBKEY)
delegateIx(payer, eata, eataBump, VALIDATOR_PUBKEY)
undelegateIx(payer, tokenMint)Program ID: 3pH9Tr8dfwTyYiKSskxsyRrPdQUXWdBX75M5ARr9bB5x
Network: Solana Devnet
Framework: Anchor 0.30.1
// Creates public deal record (amounts NOT stored here โ stay in PER)
pub fn create_deal(ctx, deal_id: u64, expiry: i64) -> Result<()>
// Increments public bid counter only โ actual bid amount stays private in TEE
pub fn submit_bid(ctx, deal_id: u64) -> Result<()>
// TEE matched off-chain โ commits winner + transfers SPL tokens atomically
pub fn settle_deal(ctx, deal_id: u64, winner: Pubkey, amount_tokens: u64) -> Result<()>
// Seller cancels โ reclaims escrowed tokens
pub fn cancel_deal(ctx, deal_id: u64, amount_tokens: u64) -> Result<()>#[account]
pub struct Deal {
pub deal_id: u64, // โ
Public โ unique identifier
pub seller: Pubkey, // โ
Public โ seller wallet
pub token_mint: Pubkey, // โ
Public โ which token
pub expiry: i64, // โ
Public โ when it expires
pub bid_count: u64, // โ
Public โ number of bids (NOT amounts)
pub status: DealStatus, // โ
Public โ Open / Settled / Cancelled
pub winner: Option<Pubkey>, // โ
Revealed post-settlement only
pub settled_at: Option<i64>, // โ
Public โ settlement timestamp
pub bump: u8,
// ๐ amount_offered โ MagicBlock PER / TEE (seller-only read)
// ๐ min_price โ MagicBlock PER / TEE (seller-only read)
// ๐ bid_amounts[] โ MagicBlock PER / TEE (per-buyer encrypted)
}- Node.js 18+
- Phantom / Solflare wallet (Devnet mode)
- Devnet SOL โ faucet.solana.com
git clone https://github.com/NikhilRaikwar/VeilDEX.so.git
cd VeilDEX.so/frontend
npm install
npm run dev
# Open http://localhost:3000Browser 1 โ Seller:
1. Connect wallet โ Authenticate with TEE
2. Tokens tab โ Deploy custom SPL token to Devnet
3. Create Offer โ token, amount: 500, min price: 0.05 SOL/token
4. ๐ Create Private Offer โ tokens locked in escrow
Browser 2 โ Buyer:
5. Connect different wallet โ Authenticate with TEE
6. Trade โ see deal with โโโโโโโโ amounts (masked)
7. ๐ Bid โ enter 30 SOL โ Submit Private Bid
Browser 1 โ Settle:
8. My Deals โ Settle
9. TEE matches best bid โ Atomic swap executes
10. ๐ Settlement Reveal โ amounts unveiled for the first time
| Item | Status | Details |
|---|---|---|
| Anchor program written | โ Done | 4 instructions: createDeal, submitBid, settleDeal, cancelDeal |
| Deployed to Solana Devnet | โ Done | 3pH9Tr8dfwTyYiKSskxsyRrPdQUXWdBX75M5ARr9bB5x |
| MagicBlock SDK integrated | โ Done | @magicblock-labs/ephemeral-rollups-sdk wired throughout |
| Anchor IDL generated + copied | โ Done | /app/idl/veildex.json |
| Item | Status | Details |
|---|---|---|
TEE auth via getAuthToken() |
โ Done | use-private-rollup-auth.ts โ persisted across sessions |
| Intel TDX verification badge | โ Done | VerificationToast + use-tdx-quote-verification.ts |
| SPL token escrow vault | โ Done | initVaultIx + transferToVaultIx โ real on-chain txns |
| EATA lifecycle (init + permission) | โ Done | initEphemeralAtaIx + createEataPermissionIx |
| Offer book with masked amounts | โ Done | blur(5px) UI โ TEE-keyed localStorage simulation |
| Private bid submission | โ Done | On-chain counter + TEE-encrypted bid terms |
| TEE settlement + atomic SPL swap | โ Done | Escrow keypair โ winner ATA + SOL โ seller |
| Settlement reveal animation | โ Done | SettlementReveal.tsx โ amounts animate โโโโ โ real |
| SPL token launcher for demo | โ Done | One-click Devnet token deployment in dashboard |
| Dark pool dashboard UI | โ Done | Full trading terminal: offer book, create, my deals |
| Landing page | โ Done | Star field canvas, MagicBlock tech section, hero |
BlockhashCacheContext integration |
โ Done | PER blockhash management (MagicBlock base) |
useEphemeralConnection hook |
โ Done | Auth-token gated PER connection |
Context: TEE auth, vault management, and EATA initialization are all live. The remaining work is the PDA delegation sequence โ which requires a program-level
#[delegate]macro change and was time-boxed for the weekend.
| Item | Status | Details |
|---|---|---|
Program-side #[delegate] macro |
๐ Pending | Anchor program modification + redeploy |
| Real EATA delegation to PER validator | ๐ Pending | Fix DelegationToSystemProgramNotAllowed โ assign + delegate same txn |
| PER permission-gated state reads | ๐ Pending | Replace localStorage with actual PER account reads |
| Ephemeral RPC bid/offer writes | ๐ Pending | Use ephemeralConnection for real private off-chain state |
Full delegateEataPermissionIx flow |
๐ Pending | PDA account assign pattern |
| Item | Status | Details |
|---|---|---|
| Multi-asset basket OTC trades | ๐ฎ Planned | Sell multiple tokens in one deal |
| Permissioned TEE pools | ๐ฎ Planned | KYC-gated dark pools for institutions |
| Mainnet deployment | ๐ฎ Planned | Real USDC, mainnet program, production infra |
| Institutional REST API | ๐ฎ Planned | Programmatic OTC desk integration |
| ZK-attested settlement proofs | ๐ฎ Planned | On-chain verifiable settlement with ZK receipts |
| Mobile wallet support | ๐ฎ Planned | Native iOS/Android via Phantom deeplink |
graph LR
P0["โ
Phase 0\nFoundation\nAnchor + Deploy"]
P1["โ
Phase 1\nMVP Build\nHackathon Submit"]
P2["๐ Phase 2\nFull PER\nDelegation"]
P3["๐ฎ Phase 3\nProduction\nMainnet"]
P0 -->|"Complete โ"| P1
P1 -->|"Complete โ"| P2
P2 -->|"2 weeks"| P3
style P0 fill:#064e3b,stroke:#22c55e,color:#f0eeff
style P1 fill:#1e3a5f,stroke:#3b82f6,color:#f0eeff
style P2 fill:#3d2060,stroke:#a78bfa,color:#f0eeff
style P3 fill:#4a1942,stroke:#f59e0b,color:#f0eeff
VeilDEX.so/
โโโ contracts/ # Anchor Program (Rust)
โ โโโ programs/veildex/src/lib.rs # Core OTC settlement logic
โ โโโ Anchor.toml # Devnet config + Program ID
โ โโโ Cargo.toml
โ
โโโ frontend/ # Next.js 14
โโโ app/
โ โโโ page.tsx # Landing page (animated)
โ โโโ dashboard/page.tsx # Main trading terminal
โ โโโ create/page.tsx # Offer creation flow
โ โโโ deal/[id]/page.tsx # Deal detail + bidding
โ โโโ idl/veildex.json # Anchor IDL
โ
โโโ components/
โ โโโ VeilDexLayout.tsx # App shell โ sidebar + topbar
โ โโโ OfferBook.tsx # Live deal table โ masked amounts
โ โโโ CreateOfferForm.tsx # Multi-step offer creation
โ โโโ BidDialog.tsx # Private bid modal
โ โโโ DealDetails.tsx # Per-user deal view
โ โโโ SettlementReveal.tsx # TEE reveal animation
โ โโโ VerificationToast.tsx # โ
TDX attestation badge (MagicBlock)
โ
โโโ hooks/
โ โโโ use-private-rollup-auth.ts # โ
TEE auth (MagicBlock โ unmodified)
โ โโโ use-ephemeral-connection.ts # โ
PER connection (MagicBlock)
โ โโโ use-tdx-quote-verification.ts # โ
TDX attestation (MagicBlock)
โ โโโ use-token-account.ts # โ
EATA state (MagicBlock)
โ โโโ use-anchor-program.ts # Anchor client setup
โ โโโ use-otc-deals.ts # Deal state management
โ โโโ use-otc-program.ts # Core OTC transactions
โ
โโโ contexts/
โ โโโ OtcContext.tsx # Unified OTC + TEE state
โ โโโ BlockhashCacheContext.tsx # โ
PER blockhash cache (MagicBlock)
โ โโโ TokenAccountContext.tsx # โ
Token account state (MagicBlock)
โ
โโโ lib/
โโโ constants.ts # VEILDEX_PROGRAM_ID + RPC endpoints
โโโ types.ts # OtcDeal, PrivateOfferTerms, PrivateBidTerms
-
Directly addresses MagicBlock's RFP โ "Onchain marketplace for illiquid assets" โ with genuine hardware privacy, not a UI trick.
-
MagicBlock SDK genuinely integrated โ
getAuthToken,verifyTeeRpcIntegrity,initVaultIx,transferToVaultIx,initEphemeralAtaIx,createEataPermissionIx,delegateIx,BlockhashCacheContext,useEphemeralConnectionโ all live and functional. -
Anchor program deployed on Devnet โ Verifiable at
3pH9Tr8dfwTyYiKSskxsyRrPdQUXWdBX75M5ARr9bB5x. -
TEE verification visible in UI โ
VerificationToastshows live Intel TDX attestation status on every page. -
Real problem, real users โ Whale traders cannot use AMMs without front-running risk. VeilDEX is the Solana-native infrastructure they need.
-
Novel primitive โ No private OTC dark pool exists on Solana today. VeilDEX is a net-new composable building block.
Built by Nikhil Raikwar for Solana Blitz v2 โ MagicBlock Privacy Hackathon 2026
Hardware-grade privacy for OTC trading on Solana.