Crypto
3 min read

DEX (Decentralized Exchange)

A non-custodial crypto exchange that lets users trade directly from their wallets via smart contracts. Most DEXes use AMMs (Uniswap, Curve), though some use on-chain order books.

How a DEX differs from a CEX

The structural difference: trades happen in smart contracts, not on a central matching engine.

  • Custody — DEX users hold their own funds in their own wallets and approve token movements transaction-by-transaction. CEX users deposit funds with the exchange.
  • Order matching — most DEXes use AMMs where the smart contract sets prices algorithmically; a few use on-chain order books.
  • Settlement — DEX trades settle directly on-chain. CEX trades settle internally on the exchange's database; only deposits and withdrawals touch the chain.
  • Identity — DEXes don't ask for KYC. Anyone with a wallet can trade.

The trade-off: DEXes give up CEX features (instant order matching, deep order books, fiat ramps) in exchange for self-custody and permissionless access.

Major DEXes

  • Uniswap — the largest DEX by all-time volume. Pioneer of the constant-product AMM. Now spans Ethereum and major L2s, with V4 introducing customizable hooks.
  • Curve Finance — specialized AMM optimized for stable-value pairs (stablecoins, ETH/stETH). Dominant for stablecoin trading.
  • Balancer — multi-token weighted pools, including index-fund-like structures.
  • PancakeSwap — dominant DEX on BNB Chain by historical volume.
  • dYdX — perpetuals-focused DEX, originally on Ethereum/L2, now on its own Cosmos appchain.
  • GMX — perpetuals on Arbitrum and Avalanche, using a multi-asset liquidity pool model rather than AMM or order book.
  • Hyperliquid — order-book perpetuals on its own L1, dominant in 2024-2025 for on-chain perps.
  • Raydium, Jupiter, Orca — leading Solana DEXes.

On-chain costs

Trading on a DEX involves several costs:

  • Pool swap fee — typically 0.05% to 1%, paid to liquidity providers. Comparable to or lower than CEX trading fees on major pairs.
  • Gas — variable. On Ethereum mainnet, a swap can cost $5-50 in gas during congestion. On L2s and alt-L1s, often pennies.
  • Slippage and price impact — for larger trades, the price moves as the trade walks the AMM curve.
  • MEV — sandwich attacks and other extraction by bots. Often invisible but can be significant on the largest trades.

For small swaps on liquid pairs on L2s, total cost is often very low. For large swaps or thin pairs, costs can exceed CEX equivalents.

DEX aggregators

A common pattern: rather than going directly to one DEX, users route through an aggregator (1inch, Matcha, ParaSwap, Jupiter on Solana). The aggregator splits the trade across multiple DEXes to find the best price and minimize slippage.

For typical retail swaps, aggregators reliably outperform single-DEX routing, often by enough to justify the slightly higher gas cost.

Spot vs. perpetuals

Two main DEX use cases:

  • Spot trading — direct token swaps. Dominated by AMMs (Uniswap, Curve, Raydium).
  • Perpetuals — leveraged derivatives, no expiration. Dominated by order-book DEXes (Hyperliquid, dYdX) and pool-based models (GMX, Drift).

Spot DEX volume is typically a fraction of CEX spot volume. Perp DEX volume is growing fast and at times approaches centralized perp volume on major chains, especially Hyperliquid.

Risks specific to DEXes

A few DEX-specific failure modes:

  • Smart-contract bugs. DEX contracts have been exploited multiple times — Uniswap V1's reentrancy vulnerability, several smaller DEXes drained entirely.
  • Pool manipulation. Trades against thin pools can be sandwiched, front-run, or manipulated.
  • Token approval risk. Approving infinite spending allows compromised contracts (or malicious upgrades) to drain wallets even after the user moves on. Best practice is to approve specific amounts and revoke after use.
  • Frontend phishing. Fake DEX UIs mimicking real ones trick users into signing malicious transactions. Bookmarking real URLs and verifying the contract being interacted with reduces this risk.

Where DEXes win and lose

DEXes win when:

  • Self-custody matters (avoiding CEX failures, regulatory restrictions, exchange access issues).
  • Long-tail tokens that aren't listed on major CEXes need to be traded.
  • Composability matters — using the swap as part of a larger DeFi transaction.
  • Permissionless access matters (institutional traders, geographically restricted users).

DEXes lose when:

  • Fiat ramps are needed (still requires a CEX as an intermediary step).
  • Speed of large complex order types matters (CEX matching engines are typically faster).
  • Customer support, account recovery, or regulated reporting matter.

For most active crypto users, both DEXes and CEXes have a role. Pure self-custody DEX-only operation works for crypto-native power users; most ordinary users blend the two depending on the task.