DEX

Also known as: Decentralized exchange

On this page 7

A DEX, or decentralized exchange, is a protocol that lets users trade crypto tokens directly from their own wallets through smart contracts, so that no intermediary takes custody of funds and every trade settles on the blockchain. In DeFi, the DEX is the core trading venue: it supplies prices, liquidity and token conversions that lending markets, yield strategies and other protocols build on.

The defining property is non-custodial, atomic settlement. A swap either completes in full within one transaction, with both sides delivered, or it fails and nothing changes. There is no account balance held by an operator, no withdrawal queue and, at the protocol level, no account opening.

How a decentralized exchange executes a trade

A trade on a DEX starts in the user’s wallet. The user grants the exchange contract an allowance to spend a token, signs a swap transaction that specifies the input amount and a minimum acceptable output, and submits it to the network. The contract computes the price, moves both tokens and reverts the whole transaction if the output would fall below that minimum.

Most DEX volume runs through an automated market maker, in which liquidity pools replace an order book. In the classic constant product formula, a pool holding two tokens keeps the product of the two reserves constant, so each purchase raises the price of the token being bought. Liquidity providers deposit both tokens and earn a share of the trading fee, typically between 0.01 and 1 percent of each swap.

Different DEX designs solve the matching problem in different ways, as the table shows.

DesignHow prices formBest suited for
Constant product AMMReserve ratio in a two-token poolLong-tail and new tokens
Concentrated liquidity AMMProviders choose price rangesMajor pairs with deep capital
Stable swap AMMCurve flattened around parityStablecoins and pegged assets
On-chain order bookLimit orders matched by protocolActive and leveraged trading
Intent or RFQ systemSolvers or market makers quote fillsLarge orders and MEV protection
Main DEX designs

Key parameters that shape trade quality

The real cost of a DEX trade is the sum of fees, price impact and network costs, not the quoted pool fee alone. Price impact depends on the trade size relative to pool depth: a trade worth 1 percent of a constant product pool moves the price by roughly 2 percent. Slippage tolerance is the user’s limit on how far execution may deviate from the quote before the transaction reverts.

ComponentTypical rangeWhat drives it
Pool fee0.01 to 1 percentFee tier and pair volatility
Price impactNear zero to several percentOrder size versus liquidity depth
Network gas feeFraction of a cent to tens of dollarsChain choice and congestion
MEV lossZero to the full slippage tolerancePublic mempool and loose limits
Cost components of a swap

DEX aggregators split an order across several pools and venues to reduce price impact. They improve execution for larger trades, but they add another contract to trust and another approval to manage.

DEX compared with a centralized exchange

A DEX trades convenience and protection for control and openness. A centralized exchange holds customer assets, matches orders on private servers and handles identity checks, fiat deposits and customer support; a DEX holds nothing on the user’s behalf and exposes every rule in public code.

AspectDEXCentralized exchange
CustodyUser keeps keys and fundsExchange holds customer assets
ListingAnyone can create a poolExchange decides what trades
SettlementOn-chain, atomic, publicInternal ledger, withdrawal later
Identity checksUsually none at protocol levelRequired by regulation
Main risksContract bugs, scams, MEVInsolvency, hacks, frozen accounts
Fiat accessNot available directlyBank deposits and withdrawals
Decentralized and centralized exchanges

Open listing is both a strength and a hazard. Any token can trade within minutes of creation, which supports innovation but also makes the DEX the main venue for copycat tokens and rug pulls. A pool showing the right ticker symbol does not prove that the token contract is the genuine one.

Using a DEX safely

Safe use rests on verifying contracts, approvals and limits before signing. Experienced users confirm the token contract address from the issuer’s official channels, keep slippage tight on liquid pairs and revoke unlimited approvals they no longer need.

SituationRecommended choiceReason
Small swap of a major pairLow slippage on a layer 2 DEXLow fees and minimal impact
Large orderAggregator or intent-based systemSplits flow and limits MEV
New or unknown tokenVerify contract and liquidity lockCopycat and rug pull risk
Stablecoin conversionStable swap poolLowest impact near parity
Practical choices when trading

Limitations and risks of decentralized exchanges

The absence of an intermediary removes counterparty risk from an operator but shifts every other risk onto the user. A decentralized exchange offers no account recovery, no chargebacks and no compensation fund, so losses from technical failures or user errors are usually final and irreversible. The most important limitations are the following.

  • Smart contract risk: a bug in a pool, router or aggregator can drain funds, and audits reduce but never remove that risk.
  • Sandwich attacks: bots buy before and sell after a visible trade, capturing value up to the user’s slippage tolerance.
  • Impermanent loss: liquidity providers can end up worse off than simply holding the tokens when prices diverge.
  • Front-end dependence: most users reach a DEX through a website that can be blocked, altered or impersonated by phishing sites.
  • Regulatory uncertainty: the treatment of DEX developers, front ends and governance token holders is still unsettled in many jurisdictions.

Put simply

A DEX is like a vending machine for digital currencies. Instead of handing money to a cashier, a person puts one token into a machine that anyone can inspect, and the machine immediately returns another token at a price set by its own rules.

Nobody holds the customer’s money in between, so there is no company to go bankrupt with it. The flip side is that nobody can reverse a mistake: sending the wrong token or trusting a fake machine cannot be undone by a support desk.

In practice

A freelance designer receives 2,000 dollars in a stablecoin on a layer 2 network and wants to convert half into ether. She opens a DEX interface from a saved bookmark, checks that the stablecoin and ether contract addresses match the official ones, and sets a slippage tolerance of 0.5 percent.

The swap routes through a concentrated liquidity pool with a 0.05 percent fee. The network fee is a few cents, the price impact is negligible and the ether arrives in her wallet in the same transaction. She then revokes the token approval she granted. The outcome is a conversion completed in seconds without an exchange account, at a total cost well under one dollar.