A swap is an operation in which one cryptoasset is exchanged for another. In DeFi, swaps commonly take place through a dApp that interacts with a liquidity pool or another smart-contract-based exchange mechanism.

Unlike a centralized exchange, where trades can be matched through an order book and matching engine, many DeFi swaps use an AMM. The execution price is then determined by pool reserves and the mathematical model used by the protocol.

Before executing a swap, the user normally specifies the input asset, output asset, and amount. The interface displays an estimated result and can define a minimum acceptable output. This limit is related to the slippage tolerance.

The final result is affected by the pool price, trade size, available liquidity, protocol fees, and slippage. The user may also pay a blockchain transaction fee for executing the transaction.

A swap can use a direct market or multiple intermediate markets. For example, exchanging Token A for Token C may route through A/B and B/C pools. Multi-hop routing can improve execution but also introduces additional operations and costs.

Users should verify the blockchain network, token contract addresses, expected output, and transaction permissions before signing. Signing a transaction authorizes the specified blockchain operation; it does not automatically make an unknown dApp trustworthy.