What Is a DEX?

Key Takeaways
A decentralized exchange (DEX) is a trading venue where traders swap one cryptocurrency for another directly from a self-custodial wallet, with trades settled by smart contracts on a public blockchain rather than through an exchange-controlled account.
DEXs differ from centralized exchanges (CEXs) along three structural axes: custody (the trader holds funds, not the platform), access (typically permissionless at the protocol level), and transparency (trades and settlements are recorded on-chain or publicly auditable).
DEXs use two main exchange architectures, automated market makers (AMMs) and order books – while DEX aggregators sit above those venues and route trades across them to find better execution.
In spot markets, AMM-based venues remain the best-known DEX model, with Uniswap among the most prominent examples.
The DEX category has expanded beyond spot swaps into leveraged derivatives. Perpetual DEXs apply the same self-custodial model to leveraged contracts that have no expiration date.
What is a DEX?
Most cryptocurrency trades still happen on centralized exchanges, but a meaningful share now runs entirely on public blockchains. Decentralized exchanges, or DEXs, let traders swap tokens through smart contracts. In many DEX designs, there is no exchange account and no custodian: traders connect a self-custodial wallet, sign each transaction, and the protocol handles the rest.
A decentralized exchange is a trading venue where functions such as pricing, settlement, and asset transfer are handled by smart contracts or publicly auditable protocol infrastructure rather than only by a private company's internal database. Depending on the design, settlement events, asset transfers, and other state changes can be verified on-chain or through public protocol infrastructure.
On-chain trading existed before 2018, but the modern DEX category took off in November 2018 when Hayden Adams launched Uniswap on Ethereum mainnet. Uniswap replaced the order book entirely with a pair of assets pooled together and priced by a simple formula. That design, an automated market maker (AMM), powered most of the spot DEX volume that followed.
That history matters because "DEX" no longer describes one product shape. Today the term covers simple spot swaps, order-book venues, aggregators, and perpetual futures exchanges. The rest of this article separates those models before moving into more specialized venues like perpetual DEXs.
How does a DEX work?
A trader using a DEX typically does not open an account. They connect a self-custodial wallet (MetaMask, Phantom, Rabby, or similar) to a DEX frontend. The frontend can read the wallet's address and propose transactions, but every actual transfer requires a signature from the wallet itself. The frontend is the interface; the trade logic lives in smart contracts on a public blockchain.
When a trader places a swap, the request is encoded into a transaction signed by the wallet and sent to the protocol's smart contracts. Those contracts handle three jobs at once: pricing the trade or matching it against another order, receiving the trader's input tokens during execution, and returning the corresponding output tokens once the swap settles. In a basic on-chain spot swap, settlement lands on a public blockchain, which makes the activity verifiable in ways a centralized exchange's internal ledger is not.
Where the liquidity for the trade comes from depends on the architecture. Some DEXs run a pool of paired assets and price trades against a formula. Others run an order book with limit orders posted by market makers. A separate routing layer, known as DEX aggregators, sits on top of multiple DEXs at once, scanning prices across venues to route a single trade through whichever path gives the best execution.
These three approaches define the main DEX types covered next.
DEX vs CEX: what's the difference?
Most retail traders still use centralized exchanges like Binance, Coinbase, or Kraken to buy and sell crypto. DEXs offer a structurally different model. The core differences come down to three areas:
Custody
On a CEX, the trader deposits funds into accounts the exchange controls and trusts the platform to hold them safely. In typical spot DEX designs, the trader keeps the funds in a self-custodial wallet, and the protocol's smart contract handles them only for the moment of the trade.
Access
CEXs typically require account creation, KYC verification (government ID, sometimes a selfie or proof of address), and in some cases minimum deposit thresholds. They may also restrict access by geography. DEXs are often permissionless at the protocol level, meaning the smart contracts will accept any wallet that can pay gas; frontends can still geofence specific jurisdictions or features depending on the operator's policies.
Transparency
On a CEX, trades and balances live on the exchange's internal ledger. On many DEXs, trades and settlement events land on a public blockchain, where any participant can independently verify what happened through a block explorer like Etherscan.
The trade-offs run in both directions. CEXs typically offer the deepest liquidity, the lowest latency, and the broadest fiat on-ramps. By contrast, DEXs offer self-custody, permissionless access at the protocol level, and on-chain auditability. The execution gap between the two has been closing in active categories, especially in derivatives, where new venue designs have brought DEX execution closer to what centralized venues offer.
Main types of DEXs
DEXs mostly use two exchange architectures: AMMs and order books. Aggregators are a third important category, but they are routing layers rather than standalone exchange designs. Each model handles pricing and liquidity differently, and each has trade-offs that matter at different trade sizes and for different markets.
AMM DEXs
An automated market maker (AMM) replaces the traditional order book with a liquidity pool and a pricing formula. Two assets are pooled in a smart contract (for example, ETH and USDC), and the contract prices swaps according to the relationship between the two pool balances. The original and most-cited formula, the constant-product invariant x * y = k, was popularized by Uniswap; it states that the product of the two pooled balances must stay constant before and after each trade. It still backs many pools today, though newer designs like concentrated liquidity, stable-swap curves, and weighted pools extend or replace it. The result is that every swap moves the price along a predictable curve, with larger trades pushing price further than smaller ones (a phenomenon known as price impact).
Anyone can supply liquidity to most AMMs by depositing both assets in the correct ratio. In return, liquidity providers earn a share of the trading fees, with fee tiers varying by protocol and pool. They also take on impermanent loss when one of the two assets moves significantly in price relative to the other. In other words, the LP's pool position can end up worth less than simply holding the two assets separately.
The model has clear strengths: AMMs are simple, can run fully on-chain, and are easy to bootstrap because liquidity can come from any participant rather than from professional market makers. The trade-off is capital efficiency: for any given trade, an AMM's price is set by the pool's reserves, not by the tightest standing quote, so spreads can widen on large trades and slippage tends to be higher than on a deep order book.
Major AMM DEXs include Curve, PancakeSwap, Raydium, and Uniswap.
Order book DEXs
An order book DEX uses the same model traditional exchanges have used for over a century: buyers post bids, sellers post asks, and the engine matches them when prices meet. Market makers post passive limit orders to provide liquidity, and traders can choose to either take an existing quote (a market order) or place their own limit order at a specific price.
Running a full order book entirely on a public blockchain has historically been difficult because matching engines need to handle thousands of order updates per second, a workload that exceeds most general-purpose blockchains' throughput. Modern order book DEXs work around this through specialized chains, layer-2 networks, or hybrid designs that move some parts of the trading flow off the most constrained base layer.
Today, the order book category is concentrated in perpetual futures rather than spot. For the architecture deep-dive and current venue landscape, see What Is a Perpetual DEX?
DEX Aggregators
DEX aggregators are not standalone exchanges; they're routing layers that sit on top of multiple DEXs at once. When a trader places a swap through an aggregator, the aggregator's algorithm scans available liquidity across dozens of venues (AMMs, order book DEXs, even other aggregators) and splits or routes the trade through whichever combination of paths produces the best price after fees and gas.
The first major DEX aggregator was 1inch, launched in 2019 by Anton Bukov and Sergej Kunz at an ETHGlobal hackathon. Other widely used aggregators include CoW Swap, Matcha, and ParaSwap.
Aggregators are most useful for trades large enough that liquidity fragmentation matters but small enough that the gas overhead of splitting across venues does not outweigh the price improvement. For very small trades, a single direct AMM swap is usually cheaper. Very large trades may instead be routed through professional market makers or OTC desks.
Benefits of using a DEX
The strongest reasons traders choose a DEX over a centralized exchange show up in the day-to-day experience of using one. Four stand out:
Self-custody during the trade. A trader using a DEX does not deposit funds with a third-party custodian. The wallet holds the assets between trades, and the smart contract holds them only for the moment of the swap. The practical difference is similar to holding cash in a wallet rather than waiting for a bank transfer: the trader can move funds without asking an exchange to approve a withdrawal.
Access without an account. Permissionless protocols let any wallet that can pay gas interact with the DEX. The protocol layer typically does not require account creation, identity documentation, or a minimum deposit; frontends can still apply geographic restrictions or compliance checks based on the operator's jurisdiction.
Breadth of listed markets. Listing a new token on a major CEX takes time, due diligence, and often a listing fee. On many AMM-based DEXs, anyone can create a market by depositing the token and a paired asset into a smart contract. The result is that DEXs typically list newer projects and smaller-cap tokens far earlier than CEXs do. (Specialized categories like tokenized stocks, prediction markets, and derivatives generally rely on additional infrastructure - oracle feeds, synthetic contracts, and the like - that goes beyond a basic spot pool.)
Composability with the rest of DeFi. A swap on a DEX is a function call on a smart contract, which means it can be combined with other DeFi actions in the same transaction. A trader can swap tokens, deposit the result into a lending market, and use it as collateral for a loan in a single click. That's the kind of programmable composition that traditional brokerage workflows do not natively support.
Trade-offs and risks
The same design choices that give DEXs their advantages also create different risks than a CEX user would face. None of these are category-defining flaws; they are structural trade-offs that come with self-custodial, on-chain trading.
Self-custody is also self-responsibility. The flip side of holding your own keys is that there is no help desk to call if something goes wrong. A lost seed phrase typically means lost funds, full stop. A trader who approves a transaction without reading what it does can lose access to wallet contents in a single signature. Wallet security, hardware-wallet use, and careful transaction review become the trader's job rather than the exchange's.
Smart-contract risk. At its core, a DEX is a piece of code running on a blockchain. Code can have bugs. Established DEXs publish their smart-contract source publicly and undergo independent audits, but neither guarantees absolute safety. Common risk mitigations include using long-standing protocols with audited contracts and sizing positions according to the trader's own risk tolerance.
Slippage and price impact. On AMMs, a large trade against a small pool can move the price meaningfully against the trader. The deeper the liquidity, the smaller the slippage. Long-tail tokens — exactly the kind a CEX may not list yet — often sit in shallow pools, where a moderately sized trade can incur a several-percent price impact. Aggregators and slippage tolerance settings help, but they do not eliminate the underlying constraint.
Gas costs and failed transactions. Every on-chain swap costs gas. During high-traffic periods, gas can become a meaningful share of the trade cost on smaller swaps. If a trade fails mid-transaction (for example, because the price moved past the trader's slippage tolerance before the transaction landed in a block), the trader still pays the gas for the failed attempt.
From DEXs to Perpetual DEXs
A spot DEX is for swapping one asset for another. A trader who wants leveraged exposure to an asset's price (without owning it, and without an expiration date forcing a roll every quarter) needs a different instrument. Perpetual futures fill that need, and the venue category that has been built around them is the perpetual DEX.
Perpetual DEXs extend the wallet-based access model into derivatives. Traders connect a wallet, post collateral, and the protocol handles pricing, margin tracking, and liquidations through code that is, depending on the venue, fully on-chain or publicly auditable. The architectures look different: many high-volume perpetual DEXs use central limit order books rather than AMMs, while spot DEX volume has historically centered on AMM design. But the underlying premise is the same: trading from a wallet rather than an exchange account.
Newer CLOB-based perpetual DEXs have become a larger part of the derivatives DEX landscape. Examples include Aster, dYdX, Hyperliquid, Lighter, and GTE (testnet).
The companion article in this series, What Is a Perpetual DEX?, walks through how those venues handle margin, liquidations, oracles, and the order-book vs AMM split in more depth.
