Decentralised 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); or
- against the DAMM 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 DAMM or each other based on the 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 liquidiation eligibility; Keeper Bots monitor 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 DAMM for a financial incentive. If two orders have the same age, the Keeper Bot will most likely fulfill 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 congestions.
A Keeper will track and fill orders and earn a reward. Guide to run is listed in ๏ปฟ๏ปฟTutorial: Keeper Bots. Incentive structures are listed in Decentralised Orderbook๏ปฟ๏ปฟ.