Understanding Drift Protocol
At the application level, Drift Protocol is a decentralized exchange that supports low slippage, low fees, and minimal price impact on all trades. Drift offers four primary products:
- Spot Trading - What is Spot Margin Trading?
- Perpetuals Trading - What are Perpetual Futures?
- Borrow & Lend - What is Borrow & Lend?
- Passive Liquidity Provision - Liquidity Provision
On-chain exchanges suffer from limitations associated with blockchains—namely, speed and limited computational capacity on-chain.
Porting over existing off-chain centralised exchange infrastructure onto the blockchain results in an inefficient use of blockchains and disincentivises market-maker participation with unfavourable conditions.
As a result, most on-chain orderbooks suffer from:
- slow fills;
- high spreads; and
- low liquidity.
Drift has designed & developed an exchange that is robust, computationally efficient, and incentivises market maker participation, as well as liquidity provision.
Trades on Drift are supported by three liquidity mechanisms:
- Just-in-Time (JIT) Auction Liquidity: provided by market makers prior to each transaction;
- Limit Orderbook Liquidity: provided by our decentralised orderbook (DLOB) made up of limit orders placed by takers that can be filled by makers; and
- AMM Liquidity: provided by Drift's AMM if no makers step in to provide liquidity.
For a more technical breakdown, check out: Just-In-Time (JIT) Auctions
All market trades (spot and perpetual) that are placed on Drift are routed through a short-term auction (default is ~ 5 seconds). During this period, market-makers can bid to fill the order at or better than the auction price, providing 'Just-in-Time Liquidity' as the fulfilment is provided for the market order submitted.
Auctions are run via a Dutch Auction (where the auction price starts at the better price and linearly moves toward a set worse end price) and market makers compete amongst themselves in speed to fulfil user orders.
For a more technical breakdown, check out: Drift AMM.
Drift's virtual AMM (DAMM) is the backstop designated liquidity provider for trades on the exchange if 1) market orders aren't filled by the JIT and 2) resting orders hit a trigger price that can be filled by the AMM.
The AMM provides a source of constant liquidity for all traders to take from. The AMM is considered constant as liquidity is available based on a constant product formula (x*y=k) balancing the reserves. Drift's AMM features an inbuilt bid-ask spread that adjusts based on inventory held by the AMM. Users can also LP into the AMM to further collateralize.
This also means that, even without external makers, Drift Protocol can support new markets without dependence on external market makers to bootstrap liquidity (albeit with additional risks on the immediate availability of unsettled PnL). Many prudent measures in the protocol's design are in place (capped exposure, effective market making, revenue pool utilization, insurance fund rules, etc) to mitigate and isolate the risks of a single market. The AMM needs a reliable oracle of the perpetual market's spot reference asset. For instance, Drift's SOL-PERP market would refer to a SOL/USD spot oracle for a spot reference. Drift currently uses Pyth for its oracles and can arbitrarily support other sources per market.
Limit Orderbook Liquidity
For a more technical breakdown, check out: Decentralised Orderbook FAQ.
Drift's decentralised orderbook (DLOB) acts as its third source of liquidity.
Limit orders are orders that trigger and execute on a particular condition. For a full breakdown of what limit orders are, visit: Order Types.
Limit orders are placed by users on-chain. A network of Keeper Bots (Keeper Bots) then sorts the on-chain limit orders into an off-chain orderbook and categorises limit orders from oldest to newest, and largest to smallest.
Each Keeper maintains its own view of the orderbook (hence the 'decentralised' aspect) and tracks new orders, AMM availability, and the oracle price. If the trigger condition of a limit order is met, the Keeper will submit the limit order and fill it against the AMM. Keepers will also match taker orders with resting limit orders if the conditions are the same.
Keepers are also incentivised to fill the oldest and largest order first. For their work, they are paid a portion of the taker fee to their Drift User Account.
The decentralised orderbook acts as a source of 'resting' liquidity as it rests on the orderbook until either a taker takes it, or the requisite market conditions are met and it's filled against the DAMM.
More about Drift
Drift Protocol is a decentralised exchange, meaning:
- all deposits, withdraws, and trades are executed on-chain and are completely transparent;
- trading requires a connection to a self-custodial Solana wallet; and
- execution of all trades is facilitated by smart contract technology with no human or third-party input to execute or fill trades.
Decentralisation offers many benefits, including:
- fairness; and
However, decentralisation also means that Drift is susceptible to the same limitations and shortcomings that arise from running on a blockchain, including:
- underlying blockchain risk;
- transaction fees;
- smart contract risk; and
- network congestion.