Architecture
This section explains how Drift works under the hood, from Solana program internals to SDK architecture and core trading mechanisms.
Why understand the architecture?
Whether you’re building integrations, running high-performance bots, or contributing to the protocol, understanding Drift’s architecture helps you:
- Build better integrations - know which data sources to use and how they relate
- Optimize performance - understand subscription patterns, account dependencies, and transaction construction
- Debug effectively - trace issues from SDK calls through to onchain state changes
- Contribute confidently - understand the system well enough to propose improvements
Architecture Overview
Drift’s architecture spans three layers:
Protocol Layer - Solana program accounts and onchain logic. See Concepts for program structure and account models.
SDK Layer - Client libraries for interacting with the protocol. See SDK Internals for subscription patterns and transaction construction.
Trading Layer - Orderbook, auctions, and matching engine. See Market Makers for DLOB, JIT, and liquidity mechanisms.
Topics
Protocol Concepts
- Program Structure - Solana accounts, PDAs, and onchain data model
- Account Model - User accounts, positions, and orders
SDK Architecture
- SDK Internals - DriftClient, subscriptions, and transactions
Trading Mechanisms
- DLOB Architecture - Decentralized Limit Order Book
- JIT Auctions - Just-In-Time price discovery
- Matching Engine - Liquidity priority flow
Related resources
- Developer docs - SDK usage and integration guides
- Protocol docs - Protocol specifications and concepts
- GitHub: protocol-v2 - Source code
Last updated on