DeFi
Swap
Trading one cryptocurrency for another on a decentralized exchange, executing directly from your wallet.
Last Updated
2026-03-29
Related Concepts
What is Swap?
A swap is a transaction exchanging one cryptocurrency for another directly from your wallet on a decentralized exchange. The DEX executes it atomically either the full trade completes or nothing happens.
How does Swap work?
- You connect your wallet to a DEX and select the tokens to exchange.
- The DEX calculates the rate from the liquidity pool and shows the expected output.
- You set a slippage tolerance and confirm the transaction.
- The smart contract transfers your input token to the pool and sends the output token to your wallet in a single atomic transaction.
Why does Swap matter?
Swaps enable permissionless trading with no account, no deposits, and no intermediary. You maintain custody of funds until the moment of execution.
Key features of Swap
- Atomic completes fully or reverts entirely
- Non-custodial funds never leave your wallet until execution
- Slippage tolerance protects against adverse price movement
- Exposed to MEV and sandwich attacks without protection
Examples of Swap
Swapping 1 ETH for USDC on Uniswap costs roughly 1 to 5 dollars in gas on Layer 2. During high congestion, a swap exceeding slippage tolerance will revert, costing gas but preserving your tokens.
