Go to app

How Onchain Perpetual Exchanges Work

Published 11/20/2026, 12:25:46 AM

Onchain perpetual exchanges (perp DEXs) are decentralized venues for trading perpetual futures — derivatives with no scheduled expiry that give traders long or short price exposure to an asset without transferring ownership of it [Source: https://lynx.finance/blog/onchain-perpetual-futures-explained]. Because there is no expiry date to force the contract price back to the spot price, perp DEXs use a set of recurring mechanisms — oracles, funding, margin, and liquidation — to keep the contract anchored to the underlying market.

1. The four prices: index, mark, funding, and trade price

A perp venue tracks several distinct prices [Source: https://docs.hypercall.xyz/docs/reference/perpetual-futures]:

Oracles are the backbone: "Oracles combine prices from several major exchanges into an index price. From that, the protocol derives a mark price, a smoothed figure it uses to value open positions and decide when to liquidate them" [Source: https://crypto.com/us/crypto/learn/what-are-defi-futures]. Aggregating many sources makes the feed harder to game — a push on one thin market gets outvoted by the others [Source: https://crypto.com/us/crypto/learn/what-are-defi-futures].

2. Funding: the anchor that replaces expiry

Funding is a regular payment between longs and shorts that keeps the perp price close to the index: "The funding rate helps keep a perpetual futures contract's price close to its index price. Funding fees are exchanged between long and short position holders. The platform does not charge a funding fee" [Source: https://www.okx.com/en-us/help/what-is-the-funding-fee-mechanism-for-on-chain-perpetual-trading]. Direction: "When the funding rate is positive, long positions pay short positions; when the funding rate is negative, short positions pay long positions" [Source: https://www.okx.com/en-us/help/what-is-the-funding-fee-mechanism-for-on-chain-perpetual-trading]. The payment amount is "the nominal value of the position, calculated at mark price, multiplied by the funding rate" [Source: https://proofoftalk.io/blog/perpetual-futures-funding-rates]. Pyth describes the same logic: funding "involves regular funding payments between long and short positions to maintain balance and prevent the futures price from deviating significantly from the spot price" [Source: https://legacy.pyth.network/usecases/perpetual-futures].

3. Margin, leverage, and liquidation

Traders deposit collateral from their own wallet, and the protocol enforces margin requirements per market — each market has its own "tick size, minimum/maximum order size, leverage, maintenance margin rate, funding interval, and open-interest cap" [Source: https://docs.nexus.xyz/trading/trading/perpetuals]. A dedicated engine "manages margin requirements for trades, and handles the liquidation of positions that run out of margin" [Source: https://docs.variational.io/variational-protocol/overview].

Liquidation triggers: "Liquidation is triggered when the maintenance margin ratio reaches or exceeds 100%, or when equity falls below zero, for the relevant margin currency or isolated position" [Source: https://www.okx.com/en-us/help/how-do-liquidation-and-adl-work-for-onchain-perpetuals]. Monitoring is continuous, not a one-time check: "Market prices are continuously updated using oracle data streams. Margin ratios and position health are recalculated in real time or at fixed intervals depending on system design. This monitoring is a continuous loop rather than a one-time check" [Source: https://aws.amazon.com/blogs/web3/building-decentralized-perpetual-futures-exchanges-on-aws].

4. The main architectural models

ModelHow it worksExamples
Order book (CLOB) with onchain settlementOff-chain or onchain matching engine; positions, margin, and settlement live onchaindYdX (migrated from Ethereum v3 to its own dYdX Chain — https://dydx.trade; verified by https://messari.io/projects/dydx/profile); Hyperliquid, "a layer one blockchain with fully onchain perpetual futures order books" (https://proofoftalk.io/blog/perpetual-futures-funding-rates; verified by https://hyperliquid.gitbook.io/hyperliquid-docs/llms-full.txt); Synthetix on Optimism uses "off-chain order matching on a high-performance CLOB with on-chain settlement" (https://synthetix.io; verified by https://github.com/Synthetixio/Synthetix-Gitbook-v3/blob/en/for-perp-integrators/perps-v3.md)
Liquidity pool (vAMM/GLP-style)LPs deposit assets into a pool; traders borrow from the pool to open leveraged positions; LPs earn feesGMX on Arbitrum/Avalanche — "30% of all protocol fees are channeled back to GMX stakers" (https://gmx.io); Jupiter Perps on Solana — JLP holders "act as counterparty to traders who borrow tokens from the pool to open leveraged positions" and earn 75% of generated fees; JLP is effectively "an index fund of SOL, ETH, WBTC, USDC, USDT" (https://jup.ag)
Collateralized debt poolStakers collateralize the system and assume proportional debt; traders trade against the poolSynthetix — "SNX is used as collateral to mint synthetic assets... Stakers earn trading fees but assume proportional responsibility for the system's total debt" (https://synthetix.io)
Hybrid (CLOB + LP backstop)Order-book matching with a liquidity-provider vault underwriting solvencyDrift on Solana (https://docs.drift.trade); Synthetix's SLP vault "backstopped by staked SNX collateral" (https://synthetix.io)

5. What this means in practice

  • No expiry ≠ no risk control. Positions stay open only while they meet margin requirements and the market remains listed [Source: https://nika.finance/blog/what-is-a-perp-dex/]. The recurring funding payment plus liquidation engine substitute for the settlement that dated futures get from expiry.
  • The tradeoff is architectural. Order-book venues (dYdX, Hyperliquid) aim for CEX-like depth and latency but concentrate matching in one venue; pool-based venues (GMX, Jupiter) make LPs the counterparty, so trader PnL is paid out of the pool and LP returns depend on fee income vs. adverse selection. Synthetix's debt-pool model spreads risk across all stakers proportionally.
  • Key risks to flag: oracle manipulation (mitigated by multi-source index feeds — https://crypto.com/us/crypto/learn/what-are-defi-futures), liquidation cascades when many positions hit maintenance margin simultaneously, and smart-contract risk in the margin/liquidation engine (https://docs.variational.io/variational-protocol/overview).

Data caveats: The two explainer pages scraped (Nika, Lynx) returned only truncated content, so the mechanics above rely on search snippets and the OKX/Chainlink/Crypto.com/Pyth/AWS documentation. Token data for Vertex Protocol (VRTX) was not returned by the search — only an unrelated meme token — so Vertex is not covered above. Prices cited for protocol tokens (GMX $6.91, JUP $0.25, JLP $3.70, DRIFT $0.0095, SNX $0.166, AEVO $0.0168, HYPE $39.09, ethDYDX $0.0263) are as of 2026-11-20 and are illustrative of the sector, not central to the mechanics.