A decentralized exchange (DEX) allows peer-to-peer crypto trading without a central intermediary. Trades happen directly on-chain via smart contracts.
How DEXs Work
| Component | What It Does |
|---|
| Smart contract | Holds liquidity and executes trades |
| Liquidity pool | Pool of tokens provided by users |
| Liquidity providers (LPs) | Users who deposit tokens to earn fees |
| AMM (Automated Market Maker) | Algorithm that sets prices |
CEX vs DEX
| Factor | CEX (Binance, Coinbase) | DEX (Uniswap, PancakeSwap) |
|---|
| Custody | Exchange holds your funds | You hold your funds |
| KYC | Required | Not required |
| Trading pairs | Any (even fiat) | Crypto only |
| Fees | Lower (0.1-0.5%) | Higher (0.3-1%) |
| Speed | Instant (off-chain) | Depends on blockchain |
| Security | Centralised risk | Smart contract risk |
How AMM Pricing Works
The Constant Product Formula (x × y = k):
| Variable | Meaning |
|---|
| x | Amount of Token A in the pool |
| y | Amount of Token B in the pool |
| k | Constant (total liquidity) |
Example: A pool has 100 ETH and 200,000 USDC. Price = 2,000 USDC per ETH. Buying 1 ETH reduces ETH in the pool and increases USDC, changing the price.
Types of DEXs
| Type | Example | How It Works |
|---|
| AMM (most popular) | Uniswap, Curve | Automated market maker |
| Order book | dYdX, Serum | Traditional order matching |
| Aggregator | 1inch, CowSwap | Routes through multiple DEXs for best price |
| RFQ | Paraswap | Request for quote |
Liquidity Pools
| Role | Reward | Risk |
|---|
| Liquidity provider | Trading fees (0.3% of each trade) | Impermanent loss |
| Trader | Trades against the pool | Slippage |
Impermanent Loss
| Price Change | Impermanent Loss |
|---|
| No change | 0% |
| 1.25× | 0.6% |
| 1.5× | 2.0% |
| 2× | 5.7% |
| 3× | 13.4% |
| 4× | 20.0% |
Impermanent loss is the difference between holding tokens and providing them as liquidity.
Popular DEXs by Chain
| Chain | Popular DEXs |
|---|
| Ethereum | Uniswap, Curve, Balancer |
| Solana | Orca, Raydium, Jupiter |
| Arbitrum | Uniswap, Camelot |
| Base | Aerodrome, Uniswap |
| Polygon | Quickswap, SushiSwap |
| BSC | PancakeSwap, Biswap |
DEX Risks
| Risk | Description |
|---|
| Smart contract bug | Hacked pool = lost funds |
| Impermanent loss | LP value drops vs holding |
| Slippage | Large trades move the price |
| Frontrunning | MEV bots exploit your trade |
| Rug pull | Malicious LP creators drain the pool |
Bottom Line
DEXs let you trade crypto without a central exchange or KYC. Uniswap is the most popular, using AMMs and liquidity pools. Risks include impermanent loss for LPs and slippage for traders. DEX aggregators like 1inch offer the best prices across multiple DEXs. Always check the smart contract risk before using a new DEX.
This content is for educational purposes only. Not financial advice. Do your own research before investing.