AMM or CLOB for your new DEX? This architecture comparison maps where each model’s attack surface actually lives: sandwich attacks and pool contract logic on AMMs, sequencer centralization and thin order books on CLOBs. See what 2025-2026 data and the Mango Markets exploit reveal, plus what a pre-launch security review must cover for each design.

AMM or CLOB for your new DEX? This architecture comparison maps where each model’s attack surface actually lives: sandwich attacks and pool contract logic on AMMs, sequencer centralization and thin order books on CLOBs. See what 2025-2026 data and the Mango Markets exploit reveal, plus what a pre-launch security review must cover for each design.
A dex architecture comparison usually starts and ends with mechanics: how pools price assets, how order books match trades. Founders picking an architecture for a new exchange need a different comparison, one built around where each model's attack surface actually lives, what it has cost traders in 2025 and 2026, and what a pre-launch audit has to cover.
If you're choosing between an automated market maker (AMM) and an on-chain order book for a new decentralized exchange (DEX), the short version is this: AMMs concentrate risk in contract logic and liquidity depth, CLOBs concentrate it in the matching and sequencing layer that sits beside the contracts. Neither model removes Maximal Extractable Value, or MEV, the profit a bot or validator can extract by reordering, inserting, or censoring trades, nor does either remove custody risk; each just moves it somewhere else. The rest of this piece maps exactly where.
A DEX lets users trade crypto assets directly from their own wallets, without a custodian holding funds between trades. QuillAudits' primer on what a decentralized exchange is covers the baseline AMM, order book, and peer-to-peer models; this section only recaps enough to set up the security comparison.
An AMM replaces a matching engine with a pricing formula. Liquidity providers deposit paired assets into a pool, and a function such as the constant-product curve (x * y = k) sets the exchange rate as the pool's balances shift. There's no order book and no counterparty to match against, just the contract and the pool. This is why AMMs became the default DEX model: the entire exchange is a small set of on-chain contracts, which makes it simple to deploy and, in principle, easier to audit than a distributed matching system. Newer AMM designs such as Uniswap v4 add programmable "hooks" to that core logic, which introduce their own vulnerability surface on top of the base pool math.
A CLOB matches buy and sell orders at explicit prices, the same model a centralized exchange (CEX) uses, but with matching and settlement logic exposed on-chain or cryptographically provable. Builders avoided this model for years because every order, cancellation, and match is a transaction, and early implementations choked on gas costs and latency. That's changed as app-chains and ZK-proven execution environments made order-book throughput viable.
Most CLOBs in practice don't run the whole matching engine on a general-purpose chain. They match orders off-chain, where it's fast and cheap, then settle the resulting trades on-chain or via a cryptographic proof, so custody and final state still depend on-chain. This hybrid split is the architecture behind every example in this post, and it's also where a second, off-chain trust boundary gets introduced that a pure AMM never has to deal with.
Order books need two things an AMM doesn't: high transaction throughput and low latency, because every order placement and cancellation is an on-chain event. Through most of DeFi's history, general-purpose chains couldn't deliver either cheaply enough. 2026 is the year three different architectures showed that problem is solvable.
KalqiX, which QuickSwap integrated on Base in 2026, runs its order matching off-chain in Rust at sub-10 millisecond speed, then settles trades with a zero-knowledge proof so order flow never touches a public mempool. Because matching happens off-chain and only the proof and settlement hit the base layer, KalqiX gets CEX-like matching speed while keeping the final trade state cryptographically verifiable on Base.
dYdX took a different route for its own app-chain. Its team explicitly rejected two earlier order-book designs: a non-matching off-chain book, which they found vulnerable to front-running and order collisions, and a centrally-matched off-chain book, which reintroduces a trusted operator. Instead, dYdX v4 runs an in-memory order book replicated on every validator; it's never written to consensus, but validators still propose and settle matched trades on-chain every block. For a deeper look at how this compares to AMM-based perpetuals design, see QuillAudits' perp DEX architecture and security comparison.
Hyperliquid is the third data point: a purpose-built L1 that runs a fully on-chain order book backed by a small validator set, trading some decentralization for the throughput a CLOB needs. All three show the same tradeoff from different angles: the matching layer moved off the critical path for cost and speed, but it didn't disappear, and every design choice about where it lives is also a choice about where trust lives.
The core security difference is this: an AMM's full attack surface sits inside its smart contracts, so a single audit scope can cover it end to end. A CLOB adds an off-chain or validator-replicated matching and sequencing layer that sits outside typical contract-audit scope and needs its own review.
AMMs are still the model most exposed to one specific, well-quantified MEV pattern: the sandwich attack, where a bot buys ahead of a user's pending swap and sells immediately after, pocketing the price impact the user's own trade created.
EigenPhi data covering November 2024 through October 2025 recorded more than 95,000 sandwich attacks on Ethereum, costing traders roughly $60 million over that period. The trend inside that window is improving, not worsening: monthly sandwich extraction fell from nearly $10 million in late 2024 to about $2.5 million by October 2025, even as monthly DEX trading volume rose from $65 billion to more than $100 billion over the same stretch. Concentration is also extreme. A single entity, the bot known as jaredfromsubway.eth, accounted for roughly 70% of all sandwich attacks on Ethereum in 2025, at an average profit of just over $3 per attack, which says more about the economics of automated extraction at scale than about any one trader's skill. About 38% of 2025 sandwich attacks targeted low-volatility, stablecoin-pair pools, precisely because tight slippage tolerances there make the attack's profit margin predictable.
That decline tracks with mitigations AMMs have shipped, from private transaction relays to protocol-level slippage protections; Uniswap's own defenses against sandwich attacks and JIT liquidity are a useful case study in how an AMM tackles DEX-level MEV risk.
An order book removes the specific mechanic a sandwich attack depends on, visible slippage tolerance on a public swap, because an order book doesn't execute against a public bonding curve. But that doesn't close the door on extraction: wherever order flow is visible before it settles, whoever sees it first can still trade ahead of it. The tradeoff in CLOBs is between an off-chain matcher that can see and reorder flow privately, and an on-chain or validator-replicated book that avoids that trust problem but has to manage latency and ordering fairness in the open. KalqiX's design, where order flow never touches a public mempool, is a direct answer to this: it removes the thing a sandwich bot watches for in the first place, though it shifts trust onto the matcher's own fairness and uptime.
A CLOB's security story doesn't end at the smart contract. Whatever matches orders, whether that's a single off-chain server, a centralized sequencer, or a small validator set, is a new component with its own failure modes, and it sits outside the scope most teams default to for a contract audit.
If one party operates the matcher, that party can, in principle, reorder, delay, or censor trades before they ever reach settlement. This is exactly the problem dYdX cited for rejecting a centrally-matched off-chain book, and it's the problem KalqiX's zero-knowledge proof of matching is designed to make cryptographically checkable rather than merely promised. QuillAudits' review of Hyperliquid's security model is a useful look at what validator concentration looks like in a live order-book chain, beyond the matching layer alone.
Order books don't need a centralized operator to fail; they can fail on liquidity alone. In October 2022, an attacker drained $116 million from Mango Markets by pushing the price of a thinly-traded perpetual contract from $0.03 to $0.91, a roughly 30x move, which inflated the paper value of the attacker's collateral enough to borrow and withdraw far more than the position was actually worth. Ben Roth, co-founder of market maker Auros, described the underlying dynamic plainly: "Adverse trading behavior is a by-product of illiquid market conditions. Therefore, when 'bad actors' are able to construct an attack vector that has a high degree of certainty due to low liquidity, the incentive to undertake these sorts of 'exploits' rises."
The lesson generalizes beyond Mango's specific protocol design: any order-book market, on any chain, inherits the same exposure the moment its book is thin enough for one actor to move price unilaterally. QuillAudits' broader catalog of DeFi attack vectors covers oracle manipulation and front-running patterns that apply to both AMM and CLOB designs.
Three mitigations recur across the CLOBs covered in this post. First, escape hatches or forced-withdrawal mechanisms that let users exit if a sequencer or matcher stalls or censors them. Second, decentralizing the sequencer or matching set, dYdX's validator-replicated book and Hyperliquid's validator-run book are two different attempts at this, so no single operator controls order flow. Third, encrypting or hiding order flow before settlement, which is what KalqiX's zero-knowledge matching achieves by proving a match happened correctly without exposing it to a public mempool first.
Both AMMs and CLOBs are typically described as non-custodial, but what gets decentralized differs. An AMM user's funds sit in a pool contract until a swap executes atomically; there's no window where a third party holds the assets. A hybrid CLOB's funds are also settled non-custodially on-chain, but the order itself may pass through an off-chain matcher before settlement, a window where the matcher sees and could, depending on the design, delay or reorder that order.
This is also the clearest way to frame the question founders actually ask when they compare a CLOB DEX to a CEX: a CEX holds user funds in its own custody between trades and settles internally, with no on-chain record until a withdrawal. A CLOB DEX, even a hybrid one, settles every trade on-chain or via a verifiable proof, so a user's balance and trade history are independently checkable at any point, not just at withdrawal. That transparent settlement is the real distinction, more than the matching mechanism itself, and it's why dYdX, Hyperliquid, and KalqiX all describe their order books as DEXs despite each using an off-chain or validator-side component to match orders.
What a security review has to cover follows directly from where each model's trust boundaries sit. An AMM's scope is self-contained in its contracts; a CLOB's scope spans contracts and a separate off-chain or distributed matching system.
A contract-focused audit of an AMM typically checks: the pricing curve and its edge cases, reentrancy in deposit, withdrawal, and swap functions, oracle integration if the AMM references external price feeds, access control on admin and upgrade functions, and, for newer designs, the permissions and state changes exposed by programmable hooks. Because the entire system lives in the contracts, one audit engagement can reasonably claim full coverage.
A CLOB needs everything an AMM audit covers for its settlement contracts, plus a second, separate review of whatever matches orders before settlement: the matching engine's logic for ordering and fairness, the sequencer or validator set's liveness and censorship resistance, and the integrity of whatever proof or attestation connects off-chain matching to on-chain settlement. QuillAudits' DeFi audit service covers smart contracts across DEXs, lending protocols, and yield aggregators in Solidity, Rust, and Move, using manual review alongside fuzzing tools including Echidna, Medusa, Foundry, and Chimera, with front-running and oracle manipulation named explicitly among the vulnerability classes in scope. That contract-level coverage applies equally to an AMM's pools and a CLOB's on-chain settlement logic. What it doesn't describe is auditing an off-chain matching engine, sequencer software, or order-propagation network as its own component, which means a team building a CLOB should plan for that as a second, infrastructure-focused engagement rather than assume one contract audit covers the whole system. QuillAudits' DeFi Smart Contract Audit services page has the full scope and methodology if you're weighing what to put in front of auditors first.
Choosing between an AMM and a CLOB before your first audit comes down to which trust boundaries your team can afford to own. If your exchange's trading pairs are stable and liquidity is your main constraint, an AMM keeps the entire attack surface inside a contract audit and skips the matching-engine review a CLOB needs. If low slippage and tight spreads at scale matter more than minimizing the number of components you have to secure, a CLOB can deliver that, but only if you scope a second review for the matching or sequencing layer alongside the standard contract audit, and only if you've picked a decentralization strategy, in the dYdX or Hyperliquid style, or a cryptographic one, in the KalqiX style, for whatever stands between a user's order and its settlement.
Either way, map every component to its trust assumption before you write a single audit scope document. A pool contract and a matching engine fail differently, and a security review that only looks at one of them has already missed half the system. A comprehensive DeFi Smart Contract Audit can cover the pricing curve, reentrancy paths, and oracle integration either model relies on; a CLOB's off-chain matching and sequencing layer still needs its own infrastructure-focused review on top of that. QuillAudits' Web3 security checklist and its research library are reasonable next stops before you scope that first engagement.
Contents

From day-zero risk mapping to exchange-ready audits, QuillAudits helps projects grow with confidence. Smart contracts, dApps, infrastructure, compliance: secured end to end.