Guide

How perp DEXs work: order books, liquidity pools and oracles

How decentralised perpetual exchanges work: on-chain order books, oracle-priced pools and virtual AMMs, plus margin, funding, liquidations and their risks.

Blockmetric ResearchUpdated 5 min read

On this page
  1. The parts every perp exchange needs
  2. Design 1: an on-chain order book
  3. Design 2: a pool that trades at an oracle price
  4. Design 3: a virtual AMM
  5. Hybrid designs
  6. Index prices, mark prices and oracles
  7. Liquidations and the backstop
  8. What the design means for market data
  9. Risks that come with the design
  10. Common questions

A perp DEX is a decentralised exchange for perpetual futures: contracts without an expiry date that track an asset's price through funding payments. Instead of a company holding customer funds and running a private matching engine, the rules for margin, matching, funding and liquidation run on a blockchain or are settled on one. Perp DEXs differ mainly in where the price comes from: an order book where traders quote each other, a pool that trades at an oracle price, or a formula.

This guide explains the main designs in neutral terms, the parts every design needs, and what the differences mean for the market data you can read from each.

The parts every perp exchange needs

Whatever the design, a perpetual futures venue has to solve the same problems:

  • Price discovery. Where does the trade price come from?
  • Margin. How much collateral backs each position, and when is it not enough?
  • An index price. A reference price from outside, so the perpetual stays close to the spot market.
  • Funding. Periodic payments between longs and shorts that pull the contract price towards the index. How funding rates are calculated shows the mechanics.
  • Liquidation. A process to close positions whose collateral no longer covers their risk, and a backstop for losses beyond that.

A centralised exchange solves these inside its own systems. A perp DEX solves them with rules anyone can inspect, and the design choices show up in how prices, liquidity and liquidations behave.

Design 1: an on-chain order book

The most exchange-like design keeps a central limit order book on chain. Traders post bids and asks, market makers quote both sides, and orders match by price and time, as on a traditional exchange.

Hyperliquid is built this way. Its HyperCore layer includes fully on-chain perpetual and spot order books, and every order, cancel, trade and liquidation happens on-chain with one-block finality.1 Each asset has its own book, and orders are matched in price-time priority.2 Running a full order book on chain needs a chain built for it: Hyperliquid states a throughput of 200k orders per second for HyperCore.1

What this means for traders and data:

  • Prices come from traders. The book's depth decides slippage, exactly as on a centralised venue. Order book depth and slippage covers the arithmetic.
  • Liquidity needs market makers. A thin book means wide spreads and fast moves.
  • Everything is visible. Orders and positions are public per address, which is why trackers can follow wallets and build liquidation heatmaps from reported liquidation prices.

Design 2: a pool that trades at an oracle price

A second family replaces the order book with a shared liquidity pool. Traders open positions against the pool at a price taken from an oracle, a feed that reports the market price from other venues. Liquidity providers deposit into the pool and take the other side of traders' net positions; they earn fees and absorb traders' profits and losses.

The trade-offs follow directly:

  • No order book depth to walk. A trade can execute at or near the oracle price regardless of size, often with fees or price adjustments that grow with size or with the pool's imbalance.
  • The oracle is critical. If the oracle can be pushed away from the true market price, the pool can be traded against at the wrong price. Designs counter this with multiple sources, limits on open interest and delays.
  • Liquidity providers carry trader risk. When traders as a group profit, the pool loses.

Design 3: a virtual AMM

A third approach prices trades with a formula, similar to the constant-product formula of spot automated market makers, but without real assets in the curve. The "virtual" reserves only set the price; collateral sits elsewhere. Large trades move the price along the curve, and funding pulls it back towards the index.

This design needs no market makers, but the curve's parameters decide how much a trade moves the price, and a badly tuned curve either moves too much or invites arbitrage against the index.

Hybrid designs

Many venues mix these ideas. A common hybrid matches orders off chain for speed and settles positions and collateral on chain. Others combine an order book with a protocol-owned liquidity pool that quotes on it. On Hyperliquid, for example, a protocol vault called HLP takes part in market making and liquidations; the guide Hyperliquid HLP and vaults explains it.

Index prices, mark prices and oracles

Every design needs a price from outside the venue. On Hyperliquid, validators publish oracle prices for each perpetual every 3 seconds, each computed as a weighted median of spot prices from several large venues, and the final oracle price is a stake-weighted median of the validators' submissions.3 That oracle feeds funding and is one input to the mark price, which in turn governs margin checks, liquidations and stop triggers.3 Mark price vs oracle price explains why the two are kept apart.

Liquidations and the backstop

A perp DEX cannot call a customer for more margin, so it closes positions automatically. On Hyperliquid, a position is liquidated when the account equity falls below the maintenance margin; the venue first sends market orders to the book, and if equity falls further without the book resolving it, a liquidator vault takes the position over.4 Pool-based designs typically close positions against the pool instead. If even the backstop cannot absorb a loss, many venues fall back on auto-deleveraging, which closes profitable opposing positions.

How liquidations on a public chain compare with those reported by centralised exchanges is covered in Perp DEX vs CEX liquidations.

What the design means for market data

QuestionOn-chain order bookOracle-priced poolCentralised exchange
Are positions visible per address?YesUsually yes, on chainNo
Is there an order book to read?YesNoYes
Where does funding come from?The contract's premium over the indexOften the imbalance between long and short open interestThe contract's premium over the index
Are liquidations public?Yes, on chainYes, on chainOnly what the exchange publishes

That is why Blockmetric's liquidation maps, whale tracking and Hyperliquid long/short come from Hyperliquid positions: an on-chain order book exchange publishes the positions themselves. For centralised exchanges we show what they publish, such as funding, open interest and liquidation streams.

Risks that come with the design

  • Smart contract and chain risk. Bugs in the exchange logic, the chain or a bridge can cause losses. Our guide on how crypto exploits happen lists the common attack types.
  • Oracle risk. A wrong or manipulated index price affects funding, marks and liquidations.
  • Liquidity risk. Thin books or small pools mean large slippage and fast cascades.
  • Transparency cuts both ways. Public positions let anyone see where large liquidations sit, including other traders.

Common questions

Is a perp DEX non-custodial? In the sense that no company holds the funds in its own accounts, yes; collateral sits under the rules of the chain or contract. The risks move from the company to the code, the chain and any bridge used to deposit.

Why can you see liquidation levels on a perp DEX but not on a CEX? On a public chain every position, and on Hyperliquid its liquidation price, can be read per address. Centralised exchanges do not publish positions.

Do all perp DEXs have funding rates? Most do, because funding is what keeps a contract without expiry close to the index. How it is computed differs by design.

Sources

  1. Hyperliquid Docs, "About Hyperliquid" (accessed 2026-11-11)Back to text
  2. Hyperliquid Docs, "HyperCore: Order book" (accessed 2026-11-11)Back to text
  3. Hyperliquid Docs, "Oracle" (accessed 2026-11-11)Back to text
  4. Hyperliquid Docs, "Liquidations" (accessed 2026-11-11)Back to text

How we collect and check the data: Data & methodology.

See today’s numbersThe live pages update continuously.

Compare venues on Funding
LiveHyperliquid markets 16sOperationalHyperliquid positions & whales 8sOperationalLiquidation heatmap & levels 15sOperationalLighter markets & liquidations 25sOperationalLighter positions & heatmap 14sOperationalLighter RH positions & heatmap 8sOperationalBinance markets 32sOperationalBybit markets 1mOperationalBinance liquidations 23sOperationalBybit liquidations 23sOperationaldYdX positions & heatmap 13sOperationalGMX positions & heatmap 18sOperationalLong/short & open interest history 34sOperationalOrder books & trade flow 9sOperationalOn-chain transfers 11sOperationalSecurity monitor 30sOperationalBlockmetric Sentiment 10mOperationalAgency releases 46sOperationalAlert delivery 8sOperationalDataset files 31mOperational16:38:18 UTCData: Blockmetric Research