Architecture Diagram
The DarkVeil protocol is built on a hybrid architecture that intelligently separates on-chain security from off-chain privacy and performance. This diagram provides a high-level overview of the protocol's components and the flow of user interactions, from depositing funds to executing a confidential trade.
This model is designed to provide the absolute security of Ethereum L1 for user funds, while leveraging the power of our AI-driven Secure Enclave network to deliver a private, fair, and high-performance trading experience.
DarkVeil Protocol Flow

Understanding the Architecture
The protocol is comprised of four key areas:
The User Layer: This is the trader, who interacts with the protocol via their wallet.
The On-Chain Layer (Ethereum L1): This is the "Trust Layer," comprised of audited smart contracts that hold all user funds and finalize the settlement of all trades.
The Off-Chain Layer (Secure Enclave Network): This is the "Privacy & Intelligence Layer," where all complex computations—like order matching and margin calculations—happen in complete confidentiality.
External Services: These are decentralized services, like Oracles, that provide essential, verified data to the protocol.
Key Interaction Flows
The diagram illustrates the three primary actions a user takes within the protocol:
1. Deposit / Withdraw: The user interacts directly with the Vault Contract on Ethereum L1 to deposit or withdraw their collateral. This flow never touches the off-chain system; it's a direct, non-custodial interaction with the most secure layer.
2. Placing a Trade (Private Interaction):
Remote Attestation: Before trading, the user's client first "challenges" the Secure Enclave (TEE) to prove it is genuine and running the correct, audited code.
Submit Encrypted Order: Once verified, the user submits their encrypted order directly to the off-chain enclave, completely bypassing the public mempool.
AI Matching: Inside the enclave, the AI Matching Engine reads the Confidential Order Book and the verified price from the Oracle Bridge to find the optimal, zero-slippage execution path.
3. Trade Settlement (On-Chain Proof):
Proof Generation: The AI engine generates a signed "Settlement Proof."
Verification & Settlement: This proof is broadcast to the Settlement Contract on-chain. The contract verifies the proof's signature and then instructs the Vault Contract to move the assets, finalizing the trade.
Last updated
