How to Swap on a DEX

A DEX (decentralized exchange) lets you trade crypto straight from your own wallet through smart contracts, with no company acting as middleman. Uniswap, Curve and Jupiter on Solana are well-known examples.

On this page 8
  1. How does a DEX work?
  2. DEX vs centralized exchange (CEX)
  3. How to swap on a DEX, step by step
  4. What do the numbers on the swap screen mean?
  5. Where does the money go if a swap fails?
  6. Risks of using a DEX
  7. Frequently asked questions
  8. Sources

A DEX, or decentralized exchange, lets you trade crypto directly from your own wallet through smart contracts, with no company in the middle. You don’t open an account or deposit funds with the exchange: you connect your wallet, choose the tokens and amount, and sign the transaction. Uniswap and Curve on Ethereum and Jupiter and Raydium on Solana are among the best-known examples.

A DEX swap usually takes two steps: first you approve the contract to spend your token, then you sign the swap itself. Below we walk through the process, explain the numbers on the swap screen and cover the risks to watch for.

How does a DEX work?

Most DEXs use an automated market maker (AMM) model. Instead of a buyer or seller on the other side of your trade, there’s a liquidity pool holding two tokens. Liquidity providers deposit those tokens, and a formula sets the price based on the ratio between them. As you add one token and take out the other, the ratio shifts and the price moves against you.

Some DEXs use an order book instead, matching buy and sell orders like a traditional exchange. On top of that, aggregators such as 1inch, CoW Swap and Jupiter split your trade across several DEXs and pools in search of a better price. That’s why the swap screen sometimes shows a “route” passing through several tokens or pools.

DEX vs centralized exchange (CEX)

  • Custody: on a CEX, your funds sit in the exchange’s wallets; on a DEX, they stay in yours.
  • Account and ID: a CEX requires sign-up and identity verification; a DEX only needs a wallet connection.
  • Token range: anyone can list a token on a DEX, which means a huge selection and a lot of fakes.
  • Fiat on-ramp: you can’t deposit dollars or euros into a DEX. You first buy crypto on a centralized exchange or on-ramp and move it to your own wallet.
  • Support: there’s no help desk to reverse a bad trade on a DEX.

How to swap on a DEX, step by step

  1. Prepare your wallet. Move the token you want to trade, plus the network’s gas token (ETH on Ethereum and its Layer 2s, SOL on Solana), into a self-custody wallet. Without gas, you can’t swap.
  2. Go to the official site. Use a bookmark or the project’s official channels; fake DEX copies are common in search ads.
  3. Connect and pick the right network. The network selected in your wallet must match the one on the DEX.
  4. Choose your tokens. Verify the token you’re buying by its contract address, not its name. Many fakes share the same name and logo.
  5. Approve. If it’s your first time using that token on the DEX, you’ll sign an approval transaction. Where possible, approve only the amount you’re trading.
  6. Review the summary and swap. Check the estimated amount, minimum received, price impact and network fee, then sign the swap.
  7. Verify the result. Check the transaction on a block explorer. If the new token doesn’t appear in your wallet, add it manually using its contract address.

What do the numbers on the swap screen mean?

  • Estimated output: what you’ll receive based on the pool’s current state. It can change before your transaction is included in a block.
  • Minimum received: the lowest amount you’ll accept. If the price falls below it, the swap fails.
  • Slippage tolerance: the percentage gap between the estimate and the minimum. Set it too high and you invite bad fills and attacks; set it too low and swaps fail often.
  • Price impact: how much your trade moves the pool’s price. Large trades in shallow pools create high impact; anything above a few percent is a sign to split the trade or find a deeper pool.
  • Network fee: the gas fee paid to get your transaction on-chain. The DEX and liquidity provider fee is usually built into the quoted price.

A hypothetical example: you’re buying ETH with 1,000 USDC, the estimate is 0.400 ETH and your slippage tolerance is 0.5%. Your minimum received is then about 0.398 ETH. If the price drops below that, the swap won’t execute and your USDC stays in your wallet.

Where does the money go if a swap fails?

In a failed swap, your tokens never leave your wallet; the whole transaction is reverted. The gas spent getting it into a block, however, isn’t refunded. The usual culprits are the price moving outside your slippage tolerance, not enough gas token, or the token’s own transfer rules. Some tokens charge a tax on every transfer, and these may need a slightly higher tolerance.

Risks of using a DEX

  • Fake and trap tokens: honeypot tokens that can be bought but not sold, and rug pulls where developers pull the liquidity, are common on DEXs.
  • Sandwich attacks: bots place their own trades just before and after transactions sent with loose slippage settings and pocket the difference. A sensible tolerance and the protected-transaction options some DEXs offer reduce the risk.
  • Contract and approval risk: a bug in the contract you use, or an exploit of a contract you’ve given an unlimited approval.
  • Fake sites: a cloned DEX interface may ask for a malicious signature instead of a swap.

Frequently asked questions

How much does a DEX swap cost?

The trading fee depends on the pool. Uniswap v2 pools charge 0.3% per swap, for example, while Uniswap v3 offers fee tiers ranging from 0.01% to 1%. You pay the network’s gas fee on top.

Is a DEX safe?

Because your funds stay in your own wallet, there’s no risk of the exchange going bust with your money. On the other hand, you carry full responsibility for contract bugs, fake tokens and malicious signatures. Using large, long-running DEXs through their official addresses and reading every signature removes much of the risk.

Sources

Read next