What Crypto Swaps Are
Crypto Swaps are trades that exchange one cryptocurrency directly for another, at a rate set in real time by either an automated liquidity pool or a matched order book, with no cash leg in between. Unlike buying crypto with a card or a bank transfer, a swap moves value from one token to another in a single step — BTC to ETH, ETH to a stablecoin, or one ERC-20 token to another. The mechanism behind that single step is what separates the two major styles of Crypto Swaps available today.
DEX swaps: trading against a pool
On a decentralized exchange, a swap trades against a liquidity pool — a smart contract holding two reserves that a constant-product formula uses to price every trade, a design popularized by Uniswap docs. There is no counterparty on the other side of your order; the pool itself is the market maker, and its contract code executes the trade the instant you sign.CEX swaps: trading against an order book
A centralized exchange matches your swap against other users' resting orders in a conventional order book, the same structure traditional markets use. The exchange holds custody of both sides of the trade, settles it on its internal ledger instantly, and only moves assets on-chain when you later withdraw.Custodial vs self-custody
The deepest difference between the two is custody. A DEX swap is self-custodial — your wallet signs the transaction and your keys never leave your device, as described in the Wikipedia entry on decentralized exchanges. A CEX swap is custodial — you deposit assets to the exchange's wallet and trust it to credit your account and honor withdrawals.How an AMM Prices Crypto Swaps
Most on-chain Crypto Swaps run through an automated market maker, or AMM. Instead of matching a buyer with a seller, the pool holds two assets in reserve and prices a trade using a formula — commonly x·y=k — that moves the exchange rate as the ratio of the two reserves shifts. Every swap changes that ratio a little, which is why a large trade against a small pool moves the price more than the same trade against a deep one.
Liquidity providers and pool fees
Pools are funded by liquidity providers who deposit both assets in a pair and earn a share of every trading fee charged on the pool in return. That fee, typically a fraction of a percent, is what makes providing liquidity worthwhile and is deducted automatically before your swap settles.Slippage, Price Impact, Fees and Gas in Crypto Swaps
Four numbers determine what you actually receive from a swap, and all four are shown before you confirm. Slippage is the gap between the quoted price and the price that executes once your transaction lands, caused by other trades or by the pool moving between quote and confirmation. Price impact is the portion of that gap you cause yourself, by trading a size large relative to the pool's depth. On top of both sits the pool or exchange fee, and for on-chain swaps, the network gas needed to execute the transaction, payable regardless of whether your price target was hit.
| Factor | DEX swap | CEX swap |
|---|---|---|
| Custody | Self-custody wallet | Exchange-held account |
| Price mechanism | AMM pool ratio | Order book matching |
| Typical cost | Pool fee + network gas | Trading fee, no gas |
Setting a slippage tolerance
Most swap interfaces let you set a maximum slippage tolerance, and the transaction reverts rather than fill at a worse price than you allowed. A tolerance set too tight can cause failed transactions during volatile periods; too loose, and a thin pool can hand you a materially worse rate than the quote suggested.Why gas varies between swaps
Gas for an on-chain swap depends on network congestion and on how many steps the route takes — a direct pair is cheaper than a route split across several pools. You can verify exactly what a past transaction paid in gas and what price it executed at by looking up the transaction hash on Etherscan.Wrapped Assets and Cross-Chain Crypto Swaps
Many Crypto Swaps involve a wrapped asset — a token on one chain that represents and is backed one-to-one by a native asset on another, such as wrapped BTC circulating on an Ethereum-compatible chain. Wrapping lets an asset that was never native to a network participate in that network's pools and swaps without the original asset ever leaving its own chain, held instead by a custodian or a bridge contract.
Same-chain swaps vs bridging first
A straightforward swap trades two tokens that already live on the same network. Moving value between different blockchains is a separate action, usually called bridging, and is often combined with a swap at the end so the bridged asset lands as the token you actually wanted rather than its wrapped intermediate form.Approvals and the Risks Around Crypto Swaps
A self-custody swap on a decentralized exchange needs one extra step the first time you trade a given token: an on-chain approval that lets the exchange's contract move that token out of your wallet up to a limit you set. Granting an approval is routine, but an unlimited or forgotten approval left open on a token you no longer use is a standing risk if that contract is later exploited. Reviewing and revoking old approvals periodically keeps the number of contracts able to touch your funds as small as possible.
Reading the quote before you sign
Before signing any swap, check the minimum amount you will receive, the fee breakdown and the network the transaction runs on. A wallet that shows you a transaction you cannot read, or a price that moved dramatically between the quote and the confirm screen, is worth pausing on rather than rushing past.Completing Crypto Swaps Step by Step
The mechanics of a decentralized swap are consistent across most interfaces, which makes the process predictable once you have done it once.
- Connect a self-custody wallet and select the asset you are swapping from and the asset you want.
- Enter the amount; the interface quotes the rate, the fee and the minimum amount you will receive.
- Approve the token for the first swap of that asset, if it is not already approved.
- Set a slippage tolerance appropriate to the pool's depth and current market volatility.
- Sign the transaction and pay network gas; the swapped asset lands in your wallet once it confirms.
Choosing Where to Run Your Crypto Swaps
Neither style of Crypto Swaps is strictly better; they trade different things for different users. A DEX swap keeps you in self-custody and gives you access to almost any token with a pool, at the cost of gas and the responsibility of managing approvals yourself. A CEX swap is often cheaper per trade and needs no gas, but requires trusting the exchange with custody until you withdraw. For background on how these assets and their markets function more broadly, the Wikipedia overview of cryptocurrency and the ethereum.org introduction to DeFi are useful starting references before committing meaningful size to either route.
What are Crypto Swaps?
Crypto Swaps are trades that exchange one cryptocurrency directly for another, priced in real time by either an on-chain liquidity pool or a centralized order book, with no cash step in between.
What is the difference between a DEX swap and a CEX swap?
A DEX swap trades against an automated liquidity pool and stays in your self-custody wallet the entire time. A CEX swap matches against a centralized order book and holds your assets in the exchange's custody until you withdraw.
What causes slippage in a crypto swap?
Slippage is the gap between the quoted price and the price that actually executes, caused by other trades moving the pool or order book between the moment you quote and the moment your transaction confirms.
What is price impact?
Price impact is the portion of slippage you cause yourself by trading an amount large relative to the pool's depth. A bigger trade against a shallow pool moves the price more than the same trade against a deep one.
Why do I need to approve a token before swapping it?
A decentralized exchange's contract needs permission to move a token out of your wallet. That one-time approval sets a limit on how much the contract can spend, and should be reviewed or revoked once you stop using that pool.
Do Crypto Swaps always involve gas fees?
On-chain swaps always need network gas to execute the transaction, in addition to any pool fee. Swaps on a centralized exchange settle on an internal ledger and typically charge only a trading fee, with no gas.
What is a wrapped asset in a crypto swap?
A wrapped asset is a token on one chain backed one-to-one by a native asset on another chain, letting that value trade in pools and swaps on a network it was never originally issued on.