For educational purposes only; not investment advice. DEX trades can lose value through price movement, poor execution, malicious tokens, approvals, MEV, or contract failure.
Direct answer
A decentralized exchange (DEX) is a protocol or market system that lets users exchange crypto assets without first depositing them into an operator-controlled trading account. A user normally connects a self-controlled wallet, obtains a quote, authorizes the required token, and signs a transaction or order. Settlement then occurs through smart contracts and on-chain transfers.
DEX describes an access and settlement model, not one specific pricing design. Some DEXs use automated market makers (AMMs) and liquidity pools; others use on-chain order books, auctions, or signed intents filled by competing parties. An aggregator or router may compare pools, fee tiers, and intermediate tokens, then split or combine routes to improve expected output.
Self-custody reduces exchange-custody risk, but it shifts verification and execution responsibility to the user. A web interface, router, solver, oracle, sequencer, governance process, or upgrade administrator may still introduce control or failure points. The word “decentralized” does not prove that every component is permissionless, immutable, audited, or safe.
How it works
- Identify the trade. Fix the chain, input and output token contract addresses, amount, and wallet. A ticker or token name is not unique. Verify the official application domain and the router or settlement contract before connecting or signing.
- Obtain and inspect a quote. The interface queries one or more liquidity sources. Check the exact input, estimated output, route, fee tier, price impact, network fee, quote expiry, and whether the route uses an intermediate token, solver, bridge, or unfamiliar contract.
- Set execution bounds. For an exact-input swap, the transaction should enforce a minimum amount out (
minOut); for an exact-output swap, it should enforce a maximum amount in. Slippage tolerance defines this execution bound. It does not improve the quoted price. - Authorize and execute. An ERC-20 swap may require an approval or signed permit before the swap. Prefer the smallest practical allowance and confirm the spender, amount, deadline, nonce, chain, calldata, and native value. The wallet signature authorizes what is encoded, not what the interface claims in plain language.
- Verify settlement. A submitted or pending transaction is not a completed swap. After confirmation, check the transaction status, token balance changes, actual amount received, gas paid, events, and remaining allowance. Revoke an allowance when its continuing convenience is not worth the exposure.
In a full-range constant-product pool, reserves x and y follow the basic relation x * y = k. With an input fee f, an exact input deltaX commonly produces:
deltaY = y * (1 - f) * deltaX / (x + (1 - f) * deltaX)
The reserve ratio supplies a marginal quote, but a finite trade moves along the curve. Its average execution price is therefore worse than the starting marginal price, and the difference grows as trade size becomes large relative to active liquidity. Concentrated-liquidity pools apply related curve logic within chosen price ranges; when a position is outside its range, it is inactive, consists entirely of one asset, and does not earn active-range swap fees.
Worked example
Suppose a constant-product pool has 100 ETH and 200,000 USDC, so its starting reserve price is 2,000 USDC/ETH. A trader sends 20,000 USDC to buy ETH, and the pool charges a 0.30% input fee. The effective input is 19,940 USDC:
ETH out = 100 * 19,940 / (200,000 + 19,940) = 9.066109 ETH
The trader spends a gross average of about 2,206.02 USDC/ETH, before gas. With a 0.50% slippage tolerance, a corresponding minimum output would be about 9.020778 ETH. That tolerance permits settlement down to the minimum; it does not guarantee the quoted 9.066109 ETH.
Now suppose a router estimates that a 50,000 USDC trade returns assets worth 47,000 USD through one direct pool, but 48,200 USD if 60% uses the direct pool and 40% takes a two-hop USDC/ETH then ETH/Token A route. The split route improves quoted output by 1,200 USD, but it also adds contract calls, gas, intermediate-token exposure, and more possible failure points. For a smaller order, those added costs may exceed the saved price impact.
Risks and controls
- Wrong or malicious asset: Anyone may create a token with a familiar name or symbol. Verify the chain and contract address through independent official sources; test an unfamiliar asset and route with a small amount.
- Approval and signature loss: An unlimited approval, malicious permit, compromised frontend, or deceptive signature can authorize more than one intended swap. Read the spender and scope, avoid blind signing, and review allowances after use.
- Execution loss: Thin liquidity, stale quotes, volatile prices, transfer-tax tokens, and public pending transactions can reduce output or cause a revert. Compare active depth and routes, use a deliberate
minOutand deadline, and do not raise tolerance merely to force a trade through. - MEV: Searchers or validators may reorder transactions or place trades around a visible swap. This can worsen execution even when the result remains inside the user’s tolerance. Consider smaller orders, deeper pools, protected routing, or limit-style execution where appropriate.
- Gas and failed transactions: Approval, swap, route hops, and allowance revocation can each cost network fees. A reverted transaction normally still consumes gas. Keep enough native currency for the full workflow and verify the chain before signing.
- Protocol and infrastructure failure: Contract bugs, unsafe upgrades, admin keys, hooks, oracles, bridges, RPC services, sequencers, and interfaces can fail or be compromised. Check the exact deployed contracts, audits, upgrade and pause powers, incident history, and dependency chain.
- Irreversibility and records: A confirmed swap usually cannot be canceled by customer support. Preserve the quote, transaction hash, token addresses, wallet balance changes, and cost basis; investigate an unexpected result before signing another transaction.
Common misconceptions
Myth 1: A token available on a DEX has passed a listing review
Many pools are permissionless, and anyone can create a same-name token or seed a pool. Availability is not approval; verify the contract address and actual liquidity.
Myth 2: Self-custody makes a transaction reversible
The user controls the signature, but a valid confirmed transaction is normally final. A mistaken token, chain, approval, or recipient remains the user’s responsibility.
Myth 3: Higher slippage tolerance produces a better price
Higher tolerance only widens the range of acceptable outcomes and lowers the chance of a slippage-related revert. It can permit worse execution and more MEV extraction.
Myth 4: Pool balance equals the amount tradable at the current price
The displayed balance spans a curve or price ranges. A large trade consumes liquidity at progressively different prices, so executable size must be evaluated from active depth, fees, route, and minOut.
Related topics
Sources
- How Uniswap Works - Uniswap Labs (accessed: 2026-08-20)
- Uniswap v2 Core - Uniswap Labs (accessed: 2026-08-20)
- Uniswap v3 Core - Uniswap Labs (accessed: 2026-08-20)
- AMM vs UniswapX Routing - Uniswap Labs (accessed: 2026-08-20)