Verified by the Drift Team

order book DEX vs AMM DEX

The article aims to provide an overview of different decentralized exchange (DEX) mechanisms, such as the order book and automated market maker (AMM) models. If you are unfamiliar with decentralized finance (DeFi), check out our introductory articles on DeFi, cryptocurrency, and AMMs. You can also read our Twitter Spaces transcript for “In the House #3: DEXs after CeFi”, a panel discussion with representatives of GMX, dYdX, and Ouroboros Capital.

What Are DEXs? 

DEXs are peer-to-peer (P2P) marketplaces that connect buyers and sellers of crypto through smart contracts instead of intermediaries or custodians in a trustless and non-custodial manner. 

In traditional finance (TradFi), traders buy and sell securities through brokers or banks that guarantee the safety and security of transactions. In crypto, trading is facilitated by centralized exchanges (CEXs) and DEXs. Like TradFi, CEXs such as Binance and Coinbase operate with a central body facilitating crypto trades while providing custody of assets to guarantee the safety and security of funds. On the other hand, DEXs promote self-custody, where users trade directly from their wallets, securing their funds with private keys. DEXs also democratize financial services while protecting user information privacy because there is no need for know-your-customer (KYC) and anti-money laundering (AML) processes typically required by CEXs and TradFi platforms. DEXs are built on Layer-1 blockchains such as Ethereum, Avalanche, and BNB Chain

Read our comparison between CEXs and DEXs here

Types of DEXs

In this article, we will expound on the three types of DEXs: order book, AMM, and hybrid DEXs. 

types of DEXs

Order Book DEXs  

DEXs using central limit order book (CLOB) models are similar to CEXs and TradFi systems in the way they match buyers and sellers. Order books also display the price and quantity of crypto trading pairs on their interface and all transactions on a public ledger. Order book DEXs are less capital efficient, especially in illiquid markets where finding matching orders quickly can be difficult due to low trading volumes, possibly leading to higher slippage. They can be further broken down into on-chain and off-chain order book DEXs.

On-chain Order Book DEXs 

With on-chain order book DEXs, all orders and transactions are recorded on the blockchain. This allows for greater transparency and decentralization since every transaction is reflected publicly. However, it can be expensive and slow because every transaction needs to be validated on-chain. Gridex Protocol is an example of an order book DEX that runs entirely on-chain. 

Off-Chain Order Book DEXs 

Off-chain order book DEXs offload on-chain trading activity by matching trades and holding trade information, such as positions and prices of assets, off-chain. This means that only the transaction for the final trading settlement will be carried out on-chain, allowing for faster transaction speeds and reduced gas fees. However, this brings about the risk of centralization since the order book and matching engines may be managed by single entities off-chain. dYdX announced that it sought to solve this centralization issue in dYdX V4. 


dYdX is an example of an off-chain order book DEX that offers perpetual futures trading for over 35 cryptocurrencies and is one of the biggest DEXs in terms of trading volume and market share. Each asset has its own order book with ask and bid prices listed, similar to CEXs. Although dYdX is a decentralized platform, it relies on a centralized system for its order book and matching engine since matching is facilitated off-chain. dYdX V4 aims to achieve full decentralization of the protocol.


AMMs use smart contracts to automate transactions, allowing users to trade their tokens with liquidity pools automatically rather than being matched directly with a buyer or seller. AMMs were popularized by Uniswap and pioneered by Bancor. Since then, AMM-based DEXs have dominated the total value locked (TVL) charts including protocols such as Curve, PancakeSwap, and Balancer

Despite its convenience, users are met with high gas fees when swapping tokens, as well as huge slippage when trying to fill their orders. This problem is accentuated in smaller liquidity pools with wider bid-ask spreads. Developers have found a way to reduce the costs and slippage through an improved AMM mechanism—concentrated liquidity market makers (CLMMs).


CLMMs, known as the next generation of AMMs, improve capital efficiency by allowing liquidity providers (LPs) to set a price range within which they would like to provide liquidity. Concentrated liquidity price ranges mitigate the problem of inefficiency that arises because traditional AMMs distribute liquidity evenly across the entire price curve though some assets fluctuate across a limited price range. However, the downside is that LPs will not earn any fees if the token price is outside the set range. CLMM DEXs include Uniswap, Trader Joe, and Orca.

Uniswap Case Study

Uniswap is a relevant case study since V1 and V2 make use of the traditional AMM mechanism, while V3 uses a CLMM model. Built on Ethereum, it uses smart contracts to automate the price-matching process, allowing users to swap ERC-20 tokens by interacting directly with the smart contracts and liquidity pools without intermediaries. Uniswap V1 and V2 use the constant product formula model to establish asset prices using the following equation: 

x × y = k 

“x” and “y” represent the amounts of each token in a pair, while “k” is the product or constant. 

In Uniswap V1 and V2, LPs must add liquidity to a pool in a 1:1 ratio, such that the relative value of each asset in the pool does not change in proportion to the other. With this model, liquidity is distributed evenly across the price curve to handle prices from 0 to infinity. This results in capital inefficiency as most assets do not move within a huge price range. For example, stablecoin pools such as USDC/USDT/DAI trade within a very small price range most of the time, between $0.99 to $1.01.

Uniswap V3

Uniswap V3 was developed with improvements to increase returns for LPs and traders, minimize slippage, and manage downside risks. It uses the CLMM mechanism, allowing LPs to decide the price range which they want to provide liquidity for, concentrating their capital within specified ranges where most of the trading volume occurs. Thus, users can earn more trading fees while experiencing lower slippage than in V1 and V2.

difference between uniswap v2 and v3

Track your Uniswap positions with Treehouse APIs, which provide DeFi analytics and comprehensive historical and current portfolio data. Contact us if you are interested!

Hybrid DEXs 

Hybrid DEXs combine the mechanisms of order book and AMM DEXs, resolving the capital inefficiencies the two models face. Hybrid DEXs may vary in the specific mechanisms used, but generally, order books are used off-chain to facilitate limit orders and AMMs are used on-chain for market orders. Market orders are orders for buying or selling assets at the current market price, while limit orders allow traders to set a price at which the buying or selling of assets will be triggered. GMX, DODO, and Drift are examples of hybrid DEXs.


Drift is a hybrid DEX built on Solana, providing a suite of services, including spot margin trading, perpetual futures trading, lending and borrowing, and liquidity provision. It is a capital-efficient solution with deep liquidity, incentivizing market maker participation while reducing gas costs and increasing transaction speeds. Drift features cross-margined trading accounts using its liquidity mechanisms: the Drift virtual automated market maker (DAMM) and decentralized limit order book (DLOB) as sources of liquidity that complement each other. Generally, the hybrid system uses the DLOB to find liquidity for limit and market orders. Otherwise, orders will get routed to the DAMM if liquidity is thin for a particular pair or the DAMM presents to be a cheaper and more price-efficient liquidity source. Users can obtain the best prices through Drift’s optimal use of both liquidity mechanisms.

selection of order types on Drift

The left-hand side of the Drift application features a panel where users can select their preferred order type.

Limit Orders
order book panel for limit orders

The right-hand side of the Drift app features an order book panel, showing the bid-ask spread for limit orders on the platform. After users place their limit orders on-chain, Drift’s Keeper Bots arrange the orders off-chain in the DLOB, sorting them according to size and time placed since larger and older orders are prioritized. Once the trigger for a limit order is met, a Keeper Bot will either satisfy it against the DAMM or against the DLOB if an opposing order happens to have the same trigger price. Keepers are rewarded with a portion of the taker fee when they match orders.

Market Orders

All market spot and perpetual futures market trades on Drift go through a short-term Just-In-Time (JIT) Auction with a default period of five seconds, and the whole process is on-chain. During this period, market makers can accept the order at the auction price or a better price, providing JIT liquidity right before the order goes through. This increases the transaction speed and provides users with the best entry price as market makers compete with one another to fill in the orders at the best price to secure the transaction. If no market makers take up the order during the JIT Auction, it will be filled against the DAMM or DLOB. 

Comparison Between DEX Mechanisms

comparison between the types of DEXs


The exchanging and trading of currencies is fundamental to the financial markets, be it DeFi or TradFi. As Web3 builders continue subverting traditional systems, we look forward to experiencing the potential that decentralized technology harnesses. In the past, all exchanges used order books to match sellers to buyers. With DeFi, traders can choose between DEXs that use the order book and AMM models or even a hybrid of the two, such as Drift. Since the nascent DeFi space is constantly growing and changing, it is always important to do your own research (DYOR) and understand the risks associated with each investment, protocol, or tool you interact with. 


This publication is provided for informational and entertainment purposes only. Nothing contained in this publication constitutes financial advice, trading advice, or any other advice, nor does it constitute an offer to buy or sell securities or any other assets or participate in any particular trading strategy. This publication does not take into account your personal investment objectives, financial situation, or needs. Treehouse does not warrant that the information provided in this publication is up-to-date or accurate.

Hyperion by Treehouse reimagines workflows for digital asset traders and investors looking for actionable market and portfolio data. Contact us if you are interested! Otherwise, check out Treehouse Academy, Insights, and Treehouse Daily for in-depth research.