Keepers & Decentralized Orderbook FAQ
Drift's decentralised orderbook is different to a traditional orderbook.
Limit orders placed on Drift's decentralised orderbook are filled either:
against each other (buys and sells at the same price);
against the AMM if the trigger conditions are met.
The orders are stored and settled on-chain. The queue is constructed by a network of off-chain Keepers that are incentivised to fill orders against the AMM or each other based on age.
Orders are executed 'best effort' by the network and are powered by special economic incentives designed to mimic the typical execution order seen in a Centralised Limit Order Book (CLOB).
When a user submits a limit order, it is submitted onto the Solana blockchain. This is known as an on-chain order.
Keeper Bots monitor all open limit orders placed on-chain. Similar to the way liquidator bots track all user positions to monitor liquidation eligibility; Keeper Bots monitor the eligibility of limit orders to be filled.
To accomplish this, Keeper Bots construct an orderbook structure off-chain categorising all the open limit orders by price, age, and then position size. Once the particular requisite trigger condition is met, the Keeper Bot will fill the oldest valid order against the AMM for a financial incentive. If two orders have the same age, the Keeper Bot will most likely fill the order that is larger in size (up to the incentive cap).
Drift doesn't construct a central limit orderbook on-chain and instead opts for a flat structure to achieve cost-effective scalability.
The network of Keepers monitor on-chain orders and constructs their own orderbooks off-chain.
This achieves (1) decentralisation (as each Keeper stores its own copy of the orderbook); and (2) computational efficiency (as the high throughput and intensive computations are calculated off-chain).
This should translate to better performance during periods of high network congestion.