Education

Order book vs AMM

By LayerZeroOct 27, 20264 min read

An order book and an automated market maker (AMM) are two ways for an exchange to match trades. An order book lists the bids and asks that traders post and matches them when prices meet, so buyers trade with sellers. An AMM has no list of orders. Traders swap against a pool of assets, and a formula sets the price from the balances in that pool.

Last updated: October 27, 2026.

How does an order book work?

Traders place limit orders, which name a price and an amount, and market orders, which take the best price available. A matching engine pairs orders by price, and usually by arrival time at the same price. Market makers supply liquidity by keeping bids and asks on both sides of the book.

On a blockchain, an order book can be fully onchain, with every order, cancellation, and match recorded by the chain. It can also be hybrid, with matching done offchain and settlement done onchain. A fully onchain book needs a chain that can handle frequent order updates at low cost, which is why chain throughput matters to trading venues. Parallel transaction execution is one way chains raise throughput, although orders on the same market touch the same state and gain less from it.

How does an AMM work?

Liquidity providers deposit assets into a pool held by a smart contract. The contract quotes a price from the pool's balances. In the widely used constant product design, the product of the two balances stays the same after each trade, apart from fees, so every purchase makes the bought asset more expensive in the pool.

Anyone can trade at any time without waiting for a counterparty, and anyone can become a liquidity provider. The price moves with the size of the trade, which is called price impact. Arbitrage traders keep the pool's price close to prices elsewhere.

How do they compare?

QuestionOrder bookAMM
How the price is setBy the bids and asks that traders postBy a formula over the pool's balances
Who the trader deals withAnother trader's orderA liquidity pool
Who supplies liquidityMarket makers and traders with limit ordersLiquidity providers who deposit assets
Limit ordersBuilt inNot built in, added by extra designs
What it asks of the chainFrequent order updates, or offchain matchingOne transaction per swap
What makes a large trade expensiveThin depth near the best pricesPrice impact as the pool's balances move

Can orders be matched without a liquidity pool?

Yes. Besides order books, request-for-quote (RFQ) systems let a trader ask market makers for a price and settle the chosen quote onchain. Batch auctions collect orders over a short period and clear them together at a single price.

Intent-based systems let a user sign the outcome they want, and solvers compete to deliver it. A solver can fill the order from its own inventory, route it to a pool, or match two users whose orders offset each other.

FAQ

Can an AMM handle limit orders?

Not on its own. A basic AMM fills every trade at the price its formula gives. Limit orders need extra logic, such as a contract that waits until the pool price reaches a target, or liquidity placed within a narrow price range.


Why do some decentralized exchanges use order books?

An order book lets traders set exact prices and lets market makers quote tight spreads, which suits active trading such as derivatives. Fully onchain books need a chain that can process many order updates, so some venues match offchain and settle onchain instead.


What is a hybrid exchange?

A hybrid exchange runs its matching engine offchain for speed and settles trades onchain, so the final record of each trade sits on the chain. What users have to trust depends on who runs the matching engine and how orders reach it.

Build trading across chains

For tools to build applications that work across chains, see LayerZero developer resources.

Connect to our team

Start building