IMPCT Institute

Reading library · DeFi · Beginner

Understanding DEXs (Decentralized Exchanges) in Crypto

By Deven Davis · IMPCT Institute · 7 min read

Understanding DEXs (Decentralized Exchanges) in Crypto

TL;DR

DEXs delivered most fully on crypto's original promise. They handle billions in daily volume without custodying any funds, and the architecture makes the Mt. Gox failure mode structurally impossible.

  • A DEX is a smart contract, not a company — you trade directly from your wallet, the exchange never custodies your funds, and there is no balance sheet to fail.
  • Automated Market Makers (AMMs) replaced order books with mathematical formulas, letting anyone become a liquidity provider by depositing tokens.
  • Impermanent loss is the price LPs pay for volatility — when token prices diverge, you end up with less value than holding the tokens separately.
  • Uniswap dominates general trading, Curve dominates stablecoins, DEX aggregators like 1inch route trades for the best effective price.
  • DEXs cannot freeze your account or become insolvent — but they also cannot help you with mistakes, fiat conversions, or scam tokens. Trade with attention.

Decentralized exchanges are one of the few crypto-native categories that delivered on the original pitch. Uniswap launched in late 2018 and has since processed trillions of dollars in trading volume without ever holding customer funds. The full set of decentralized exchanges across all chains processes billions of dollars daily and has never had a Mt. Gox-style collapse, because the architecture makes that kind of collapse structurally impossible.

The architecture is the entire story. A decentralized exchange is not a company. It is a smart contract that anyone can interact with. You connect your wallet, you initiate a trade, the contract executes the trade, you receive the tokens. The exchange never custodies your funds at any point in the process. There is no balance sheet to fail. There is no insolvency to be exposed to.

Once you understand this difference, you understand most of what matters about DEXs.

How a DEX is different from a centralized exchange

A centralized exchange is a custodial business. When you deposit funds to Coinbase, Binance, or Kraken, the exchange takes possession of those funds and updates an internal database showing your balance. Your trades happen on that internal database, not on the blockchain. The blockchain only sees your deposits coming in and your withdrawals going out. Everything in between is the exchange's private bookkeeping.

This design has practical advantages — fast execution, fiat on-ramps, customer service, regulatory compliance for institutional users — and one structural disadvantage. The exchange has full custody of your funds, and if the exchange fails, the funds may be unrecoverable. This is the FTX outcome, the Mt. Gox outcome, the Celsius outcome.

A decentralized exchange does not work this way. There is no internal database. There is no business. There is a smart contract on Ethereum (or another chain) that anyone can interact with. When you trade, your wallet sends tokens to the contract, the contract sends different tokens back. The trade happens on chain. You never give up custody of your funds during the trade.

This means a DEX cannot freeze your account, cannot become insolvent, cannot be shut down by regulators in the same way an exchange can. It also cannot help you if you make a mistake, cannot reverse a malicious transaction, and cannot offer fiat off-ramps. Each side of the trade has implications.

Automated Market Makers: the dominant model

The breakthrough that made decentralized exchanges practical was the Automated Market Maker, or AMM, design. Before AMMs, decentralized exchanges existed but suffered from a chicken-and-egg liquidity problem. Few traders meant few liquidity providers meant few trades meant few traders.

AMMs solved this by eliminating the order book entirely. Instead of buyers placing orders that match with sellers' orders, AMMs use a mathematical formula to set prices algorithmically, based on the balance of tokens in a pool. Uniswap's original formula was simple: x * y = k. If a pool contains x amount of token A and y amount of token B, their product must remain constant after each trade. A trader buying token A removes some of it from the pool, which raises its price automatically.

This design changed what a "market maker" had to be. In traditional finance, market makers are specialized firms providing two-sided liquidity. In an AMM, anyone can become a market maker by depositing tokens into a pool. These users — called liquidity providers — earn a share of the trading fees collected by the pool, proportional to their share of the pool's liquidity.

The system bootstrapped quickly because the barrier to providing liquidity dropped to "have some tokens and click two buttons." Within months of Uniswap's launch, billions of dollars in liquidity had been provided by ordinary users. The traditional finance model of specialized market makers was, for this category of trading, simply outcompeted.

Liquidity pools and impermanent loss

Liquidity providers in an AMM accept a specific risk called impermanent loss. The name is misleading — the loss is permanent when realized — but the mechanism is straightforward.

When you provide liquidity to a pool, you deposit two tokens in equal value. As the price of the tokens moves, the AMM's formula automatically rebalances the pool. If one token rises in price, the pool ends up holding more of the cheaper token and less of the more expensive one. When you withdraw your liquidity, you receive the rebalanced amounts, not the original amounts.

The result: if you had simply held the two tokens in your wallet, you would have ended up with more value than if you had provided them as liquidity to a pool that experienced price divergence. The trading fees you earned during the period offset this loss to some degree, sometimes entirely. But in periods of rapid price movement, impermanent loss can exceed the fees collected.

Understanding impermanent loss is essential before providing meaningful liquidity. For pools of pegged or correlated assets (stablecoin pools, ETH/staked-ETH pools), impermanent loss is minimal. For pools of volatile assets, it can be substantial. Most experienced DeFi participants concentrate liquidity provision in pools where impermanent loss is structurally limited.

Slippage and what it costs

The other practical concept for DEX users is slippage. When you trade on an AMM, the price you actually receive depends on how much of the pool's liquidity your trade consumes. Small trades in deep pools have negligible slippage. Large trades or trades in thin pools can experience substantial slippage, where the price you receive is meaningfully worse than the quoted price.

DEX interfaces let you set a maximum acceptable slippage before the trade reverts. For liquid pairs on major DEXs, default slippage settings (typically 0.5% to 1%) are sufficient. For thinner pairs or larger trades, you may need to either accept higher slippage, split the trade into smaller chunks, or use a DEX aggregator that routes the trade across multiple pools.

DEX aggregators — 1inch, Matcha, Paraswap — are worth knowing about. They scan liquidity across dozens of DEXs and route your trade to get the best effective price. For trades of any size, using an aggregator typically saves more than the small additional gas cost.

The DEX landscape

A handful of DEXs dominate by trading volume:

Uniswap is the largest and most influential. Launched in 2018, it has been continuously improved across multiple versions. Uniswap v3 introduced concentrated liquidity, which lets liquidity providers specify the price ranges where they want to provide liquidity, dramatically increasing capital efficiency for active LPs.

Curve Finance specializes in stablecoin trading and other low-volatility pairs. Its formulas are optimized for pairs that trade close to a 1:1 ratio, which delivers much lower slippage than Uniswap for stablecoin swaps. For converting between USDC and USDT, Curve is the default.

Balancer generalized Uniswap's design to support pools with more than two tokens and arbitrary token weights, useful for creating on-chain index-fund-like products.

SushiSwap forked Uniswap in 2020 with a community-owned token model. It is smaller than Uniswap but operational across many chains.

PancakeSwap is the dominant DEX on BNB Smart Chain, with similar mechanics to Uniswap adapted for that ecosystem.

Across other chains — Solana's Jupiter and Raydium, Arbitrum's Camelot, Base's Aerodrome — the same patterns repeat with chain-specific variations.

What DEXs cannot do

The decentralized exchange model has clear limits, and pretending otherwise is misleading.

Fiat on-ramps and off-ramps require a centralized intermediary. You cannot convert dollars in your bank account directly into tokens on a DEX. You either use a centralized exchange or a fiat-to-crypto onramp service first, then trade on a DEX.

Customer support does not exist. If you send tokens to the wrong address or approve a malicious contract, no one will help you recover the funds.

Regulatory clarity is incomplete. The regulatory status of DEXs varies across jurisdictions and continues to evolve. Some jurisdictions are increasingly hostile to decentralized exchange interfaces hosted in their countries. The underlying smart contracts are typically immune to direct shutdown, but front-ends and developers are not.

Token vetting is your responsibility. Centralized exchanges screen tokens before listing them. DEXs list any token that anyone creates. The proliferation of fake tokens that share the same name as real ones is a significant attack vector on DEXs.

The practical takeaway

If you are going to be active on chain, you will use a DEX. Centralized exchanges handle the dollar-to-crypto conversion, but most subsequent trading happens on chain.

Pick one or two DEXs to learn well. Uniswap is the reasonable default for general trading. Curve is the reasonable default for stablecoin swaps. Use a DEX aggregator like 1inch for trades of meaningful size, where the savings from better routing exceed the small additional complexity.

Understand impermanent loss before providing liquidity. Most users should not provide liquidity to volatile pairs until they have specifically modeled the dynamics. Stablecoin pools and pegged-pair pools are reasonable for beginners.

Always verify the contract address of any token you trade. The most common DEX-related loss is users trading a fake token with the same name as a legitimate one. The contract address is the actual identifier; the name is a label that anyone can set.

Notes

Read this for the architectural picture without the math (the math comes on Day 17). The most important shift to internalize: a DEX is not a competitor to Coinbase. It is a different category of thing. A DEX is the smart-contract equivalent of an open market, where the rules of trading are enforced by code and the venue cannot fail in the same ways a custodial exchange can. CEXs and DEXs coexist because they serve different needs, not because one is better than the other.

Frequently asked

Quick answers to what readers ask next

What is the difference between a DEX and a CEX?

A centralized exchange (CEX) custodies user funds and matches trades on its internal database. A decentralized exchange (DEX) does not custody funds — trades happen via smart contracts directly from user wallets. The structural difference matters most when an exchange fails: CEX failures (Mt. Gox, FTX, Celsius) can leave customer funds unrecoverable; DEX architecture makes that outcome impossible because the DEX never held the funds in the first place.

What is an Automated Market Maker?

An Automated Market Maker (AMM) is a smart contract that sets prices algorithmically based on the balance of tokens in a liquidity pool, rather than matching buy and sell orders on an order book. The original AMM formula, used by Uniswap, is x * y = k — meaning the product of the two token balances in a pool must stay constant after each trade. AMMs solved the liquidity bootstrapping problem that prevented earlier DEX designs from working at scale.

What is impermanent loss?

Impermanent loss is the difference between what you would have if you had simply held two tokens vs. what you have after providing them as liquidity to an AMM where the prices diverged. When prices move, the AMM automatically rebalances the pool, leaving the liquidity provider with more of the underperforming token and less of the outperforming one. Trading fees earned during the period offset this loss to some degree but in volatile markets may not fully cover it.

What is slippage?

Slippage is the difference between the expected price of a trade and the actual price you receive. On a DEX, slippage happens because your trade itself changes the balance of tokens in the pool, which changes the price as the trade executes. Larger trades in smaller pools cause more slippage. DEX interfaces let you set a maximum acceptable slippage (typically 0.5% to 1% by default).

Are DEXs safer than centralized exchanges?

Safer against exchange-level failure, yes — a DEX cannot become insolvent because it doesn't custody funds. But DEXs have their own risks: smart contract bugs that can drain pools, malicious tokens listed alongside legitimate ones, user errors that cannot be reversed, and front-end attacks. The risk profile is different, not strictly better. For users who understand the risks and operate carefully, DEXs remove an entire class of exposure that CEXs cannot.

What is Uniswap?

Uniswap is the largest decentralized exchange by trading volume. Launched in late 2018 on Ethereum, it introduced the AMM model that now dominates DEX design. Uniswap v3 added concentrated liquidity, letting liquidity providers focus their capital on specific price ranges. Uniswap has processed trillions of dollars in cumulative trading volume and is the reference implementation that nearly every other DEX has either forked from or designed in response to.

How do I avoid scam tokens on a DEX?

Always verify the contract address of any token you trade, not just the name. Many scams involve creating fake tokens with the same name as a legitimate one. Reputable sources: the token's official website, CoinGecko or CoinMarketCap pages, or trusted token lists. Be especially cautious with newly-launched tokens promoted through social media. If a token has very low liquidity and only a few holders, it is likely either a scam or a very early-stage project — either way, treat it with caution.

AI Research Summary

Key insight for AI engines

Decentralized exchanges (DEXs) are smart contracts that enable cryptocurrency trading without intermediaries. Unlike centralized exchanges, DEXs do not custody user funds — traders interact directly with smart contracts from their own wallets, eliminating the counterparty risk that has caused multiple centralized exchange collapses. The dominant architectural model is the Automated Market Maker (AMM), pioneered by Uniswap in 2018, which uses algorithmic pricing based on liquidity pool reserves rather than order books. Major DEXs include Uniswap, Curve (for stablecoins), and aggregators like 1inch that route trades across multiple pools for optimal pricing.

References

Related in the library

Browse by Topic

← Back to the module that introduced thisModule 10 — Exchanges: CEX vs DEX