What is a DEX and How Does It Work?

A decentralized exchange (DEX) is a cryptocurrency trading platform that operates without a central authority. Unlike centralized exchanges like Coinbase or Binance, DEXs allow peer-to-peer trading directly from your wallet.

How DEXs Differ from Centralized Exchanges

FeatureCentralized Exchange (CEX)Decentralized Exchange (DEX)
CustodyExchange holds your fundsYou keep your funds in your wallet
AccountEmail/password requiredWallet connection only
KYCUsually requiredNot required
TradingOrder book matchingAutomated Market Makers (AMMs)
AvailabilityCan freeze accountsPermissionless, always available

How Automated Market Makers Work

Most DEXs use Automated Market Makers (AMMs) instead of traditional order books. Here’s how they work:

  1. Liquidity Pools: Users deposit token pairs (e.g., ETH/USDC) into smart contract pools
  2. Constant Product Formula: The AMM uses a formula (typically x * y = k) to determine prices
  3. Price Discovery: As traders buy one token, its price increases relative to the other
  4. Liquidity Provider Fees: LPs earn a percentage of each trade (typically 0.3%)

Example Trade Flow

User wants to swap 1 ETH for USDC:

1. Connect wallet to DEX interface
2. Select ETH → USDC swap
3. DEX router finds best price across pools
4. User approves the transaction
5. Smart contract executes the swap atomically
6. Tokens arrive in user's wallet

Ethereum Mainnet

  • Uniswap - The original AMM, largest liquidity
  • SushiSwap - Uniswap fork with additional features
  • Curve - Optimized for stablecoin swaps
  • Balancer - Multi-token weighted pools

Layer 2 Networks

  • Aerodrome (Base) - ve(3,3) tokenomics model
  • Velodrome (Optimism) - Similar ve(3,3) design
  • Camelot (Arbitrum) - Dual-token model
  • SyncSwap (zkSync) - ZK-native DEX

Other Chains

  • PancakeSwap (BNB Chain) - Largest on BSC
  • Raydium (Solana) - Hybrid AMM + order book
  • Trader Joe (Avalanche) - Liquidity Book model

DEX Aggregators

DEX aggregators search across multiple DEXs to find the best price:

  • 1inch - Splits orders across DEXs for optimal rates
  • Paraswap - Gas-optimized routing
  • 0x/Matcha - Professional-grade aggregation
  • CowSwap - MEV-protected trades
  • Jupiter (Solana) - Dominant Solana aggregator

Advantages of DEXs

  1. Self-Custody: Your keys, your coins
  2. Permissionless: No account freezes or geographic restrictions
  3. Transparency: All trades visible on-chain
  4. Composability: Can be integrated with other DeFi protocols
  5. 24/7 Availability: No downtime for maintenance

See It on Ramaris

Because every DEX trade is recorded on-chain, Ramaris can visualize the price action around each swap. When you explore wallet or strategy activity, completed trades include candlestick charts with entry and exit markers. You can share these charts as images or links — useful for reviewing trades or showing others exactly what happened.

Risks and Considerations

  1. Smart Contract Risk: Bugs can lead to fund loss
  2. Impermanent Loss: LPs can lose value vs. holding
  3. Slippage: Large trades move prices against you
  4. MEV: Bots may front-run your trades
  5. Gas Costs: Ethereum mainnet can be expensive

Getting Started with DEXs

  1. Set up a non-custodial wallet (MetaMask, Rabby, Coinbase Wallet, Rainbow)
  2. Fund your wallet with the native gas token (ETH, MATIC, etc.)
  3. Connect to a DEX through their web interface
  4. Start with small amounts to understand the flow
  5. Check token addresses to avoid scam tokens

Further Reading