Glossary

Decentralized Exchange (DEX)

A non-custodial trading platform where users swap tokens directly from their wallets without depositing funds to a central party.

Key Takeaways

  • A DEX lets users trade crypto directly from their wallets using smart contracts, with no central party holding funds. This eliminates custody risk and removes the need for KYC/AML verification.
  • The two main DEX architectures are AMM-based (Uniswap, Curve) and order-book-based (dYdX). AMMs use liquidity pools and mathematical formulas to price assets, while order books match individual buyers and sellers.
  • DEXs now handle roughly 20% of global spot crypto trading volume. Bitcoin-native DEX solutions like atomic swaps and THORChain enable cross-chain trading without wrapped tokens or centralized bridges.

What Is a Decentralized Exchange?

A decentralized exchange (DEX) is a peer-to-peer marketplace where cryptocurrency trades execute directly between users via smart contracts on a blockchain. Unlike centralized exchanges (CEXs) such as Coinbase or Binance, a DEX never takes custody of user funds. Traders connect their wallets, approve a transaction, and the swap settles on-chain: no account creation, no deposits, no withdrawal queues.

The motivation behind DEXs is straightforward: when a centralized exchange holds your funds, you face counterparty risk. The collapse of FTX in 2022, which left users unable to access billions in deposits, demonstrated this risk in dramatic fashion. DEXs eliminate this single point of failure by replacing the intermediary with code that anyone can audit.

DEXs are a core primitive of decentralized finance (DeFi). Their composability allows other protocols to build on top of them: lending platforms can liquidate collateral through DEXs, yield strategies can rebalance through DEXs, and payment applications can source liquidity from DEX pools.

How It Works

There are two dominant architectures for decentralized exchanges, each with distinct tradeoffs in capital efficiency, execution speed, and user experience.

AMM-Based DEXs

Automated Market Makers (AMMs) replaced the traditional order book with liquidity pools and mathematical pricing formulas. Instead of matching a buyer with a seller, an AMM lets users trade against a pool of tokens locked in a smart contract.

Liquidity providers (LPs) deposit pairs of tokens into these pools and earn a share of trading fees in return. The most common pricing mechanism is the constant product formula:

x * y = k

where:
  x = quantity of Token A in the pool
  y = quantity of Token B in the pool
  k = constant (the product must remain unchanged after each trade)

When a trader buys Token A, they add Token B to the pool and remove Token A. The reduced supply of Token A raises its price relative to Token B, maintaining the invariant. Larger trades relative to pool size cause more slippage: a worse execution price caused by moving the pool's ratio further from equilibrium.

Consider a pool with 10 ETH and 20,000 USDC (k = 200,000). The implied price is 1 ETH = 2,000 USDC. A buyer purchasing 1 ETH would need to deposit enough USDC to maintain k with 9 ETH remaining: roughly 2,222 USDC, an effective price of ~2,222 per ETH due to slippage.

Uniswap pioneered this model in 2018. Later iterations introduced improvements: Uniswap v3 added concentrated liquidity (LPs allocate capital to specific price ranges for better capital efficiency), and Curve Finance developed a StableSwap invariant optimized for similarly priced assets like stablecoins, providing near-zero slippage near the peg.

Order-Book DEXs

Order-book DEXs match buyers and sellers through limit orders, similar to traditional stock exchanges. Users place bids (buy orders) and asks (sell orders) at specific prices, and the matching engine pairs compatible orders.

dYdX is the leading order-book DEX, focusing on perpetual futures and leveraged trading. It operates its own Layer 1 blockchain built on the Cosmos SDK with CometBFT consensus, enabling high throughput and low latency that would be impractical on a general-purpose chain like Ethereum.

Order-book DEXs offer familiar trading interfaces with limit orders, stop-losses, and other advanced order types that AMMs typically lack. The tradeoff: they require significant liquidity from market makers to maintain tight spreads, and fully on-chain order books face throughput constraints on most blockchains.

Intent-Based DEXs

A newer architecture gaining traction since 2024: intent-based DEXs. Instead of interacting directly with a liquidity pool or order book, users sign an "intent" describing their desired outcome ("swap 1 ETH for at least 2,000 USDC"). A network of solvers then competes to fill the order at the best possible price.

UniswapX, CoW Protocol, and 1inch Fusion all use variations of this model. Intent-based systems can route across multiple liquidity sources, protect users from front-running, and even enable gasless swaps where the solver pays the transaction fee.

DEXs vs. Centralized Exchanges

FactorDEXCEX
CustodyNon-custodial (user holds keys)Custodial (exchange holds funds)
IdentityNo KYC requiredKYC required
Token listingPermissionlessCurated
Fiat supportCrypto-to-crypto onlyFiat on/off ramps
Order typesMostly market swaps (expanding)Full range (limit, stop, etc.)
ComposabilityIntegrates with DeFi protocolsSiloed
RiskSmart contract bugsExchange insolvency

Bitcoin-Native DEX Solutions

Most DEX activity occurs on Ethereum, Solana, and BNB Chain, but several solutions exist for trading Bitcoin without centralized intermediaries.

Atomic Swaps

Atomic swaps use Hash Time-Locked Contracts (HTLCs) to enable trustless cross-chain trades. The process works as follows:

  1. Alice generates a secret and locks her BTC in an HTLC with a hash of that secret
  2. Bob locks his asset on the other chain using the same hash
  3. Alice reveals the secret to claim Bob's asset
  4. Bob uses the revealed secret to claim Alice's BTC

The swap is atomic: either both sides complete or neither does. If Alice fails to reveal the secret before the timelock expires, both parties reclaim their funds. No intermediary is needed.

Cross-Chain DEXs

THORChain is the leading cross-chain DEX for Bitcoin. It enables native swaps between BTC, ETH, BNB, and other assets without wrapped tokens, using its own validator network and liquidity pools with RUNE as the intermediary settlement asset.

Bisq takes a different approach: a fully decentralized, peer-to-peer desktop application for trading Bitcoin for fiat currencies or other crypto. It uses Tor for privacy and a multisig escrow system for trade security.

Layer 2 networks like Spark are expanding what's possible for Bitcoin-native trading. By moving transactions off the main chain while preserving self-custody, L2s can support faster, cheaper swaps that would be impractical on Bitcoin's base layer. For a deeper comparison of Bitcoin scaling approaches, see the Bitcoin Layer 2 comparison.

Use Cases

  • Token swaps: the most common use case. Users exchange one token for another directly from their wallet. DEX aggregators like Jupiter and 1inch route trades across multiple pools for best execution.
  • Liquidity provision: users deposit token pairs into AMM pools and earn a share of trading fees. This is the primary way DEXs source their liquidity.
  • Permissionless token launches: new projects can create trading pairs by providing initial liquidity, bypassing the listing process and fees of centralized exchanges.
  • Cross-chain trading: protocols like THORChain and atomic swap implementations enable trading across different blockchains without centralized bridges.
  • Perpetual futures: order-book DEXs like dYdX and Hyperliquid now offer leveraged derivatives trading with decentralized settlement.
  • Stablecoin swaps: Curve and similar DEXs provide low-slippage swaps between stablecoins like USDC, USDT, and DAI, critical infrastructure for the stablecoin payments ecosystem.

Risks and Considerations

MEV and Front-Running

Maximal Extractable Value (MEV) is one of the most significant risks on AMM-based DEXs. Because pending transactions are visible in the mempool before confirmation, bots can exploit this transparency. The most common attack is the sandwich: a bot places a buy order before a victim's swap and a sell order after it, extracting the maximum allowed slippage as profit. Intent-based DEXs and private transaction pools are emerging as mitigations.

Smart Contract Risk

DEX smart contracts hold billions of dollars in liquidity. Bugs, vulnerabilities, or governance exploits can lead to catastrophic loss of funds. While major DEXs like Uniswap have extensive audit histories, newer or forked protocols may not. Users should verify that a DEX's contracts have been audited and consider the protocol's track record before providing liquidity.

Impermanent Loss

Liquidity providers on AMM-based DEXs face impermanent loss: when the price ratio of pooled tokens diverges from the initial deposit ratio, the LP ends up with less value than if they had simply held both tokens. The loss is "impermanent" only if prices return to the original ratio. For volatile pairs, impermanent loss can exceed the trading fees earned.

Scam Tokens

Permissionless listing is both a feature and a risk. Anyone can create a token and add liquidity for it on a DEX, including tokens designed to defraud buyers: honeypots (tokens that can be bought but not sold), fake versions of popular tokens, and rug pulls where the creator drains the liquidity pool. Always verify token contract addresses through official project channels before trading.

Gas Costs and Network Congestion

On-chain trades require gas fees. On Ethereum mainnet during periods of high demand, a single swap can cost $10 to $50 or more in gas, making small trades uneconomical. Layer 2 networks and alternative chains have largely addressed this: swaps on Arbitrum, Base, or Solana typically cost fractions of a cent. However, users bridging assets to these networks face additional complexity and risk.

Regulatory Uncertainty

The regulatory landscape for DEXs remains unsettled. In February 2025, the SEC closed its investigation of Uniswap Labs without enforcement action, a significant development for the DeFi space. However, multi-jurisdictional exposure persists, and the classification of DEX governance tokens and LP positions under securities law continues to evolve. The GENIUS Act and similar legislation may indirectly affect how DEXs handle regulated assets like stablecoins.

This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.