What a decentralised exchange is, and how a swap works
A DEX has no company, no account and no order book. It is a program on a blockchain that holds two piles of tokens and lets anyone trade one for the other. This lesson follows a single swap from your wallet to the pool and back.

What you will learn
- A DEX is a smart contract. Trades happen directly from your wallet, and the contract, not a company, holds the funds.
- Most DEXs replace the order book with a liquidity pool — a reserve of two tokens whose ratio sets the price.
- Every swap is a public transaction, so DEX volume can be measured exactly from the chain rather than reported by a venue.
A centralised exchange, as the exchanges lesson described, is a company running a matching engine. You deposit funds, the company holds them, and it matches your orders against other customers'. A decentralised exchange (DEX) removes the company. What remains is a program.
A program that holds tokens
A DEX is a smart contract: code deployed on a blockchain that holds tokens and follows fixed rules for releasing them. The rules are public, run identically for everyone, and cannot be changed by a support desk. Uniswap on Ethereum, PancakeSwap on BNB Chain, Raydium on Solana and Aerodrome on Base are all contracts of this kind.
Because the contract holds the funds, there are no accounts and no deposits. You connect a wallet, sign a transaction, and the contract takes one token from your address and sends another back in the same transaction. Nothing sits with a third party between those two steps.

Pools instead of order books
Most DEXs do not keep a list of bids and asks. Instead, each trading pair has a liquidity pool: a reserve of both tokens, deposited by users called liquidity providers, who earn a share of the trading fees in return.
The price is the ratio of the two reserves. If a pool holds 100 ETH and 300,000 USDC, the pool prices ETH at 3,000 USDC. When you buy ETH from the pool you add USDC and remove ETH; the ratio shifts and the price for the next buyer is a little higher. Sell and it moves the other way.
This is an automated market maker (AMM). The next lesson works through the formula; for now the essential points are:
- The pool always quotes a price. There is no waiting for a counterparty.
- The price moves with every trade, in proportion to the trade's size against the pool's reserves.
- Anyone can create a pool for any pair by depositing both tokens.
That last point is why a DEX lists tens of thousands of tokens hours after they are created, and why most of them have almost no liquidity.
Following one swap
Suppose you swap 1,000 USDC for ETH on Uniswap.
- Quote. Your wallet's interface asks the router contract for the best route — perhaps directly through the USDC/ETH pool, perhaps via an intermediate token if that yields more ETH.
- Approval. The first time you trade a token, you sign an approval allowing the router to move that token from your wallet. This is a separate transaction and a major security topic, covered in the approvals lesson.
- Swap. You sign the swap. The transaction states the input amount and a minimum output you will accept — your slippage tolerance.
- Execution. A block producer includes the transaction. The router pulls 1,000 USDC, passes it through the pool, and sends the ETH to your address. If the pool's price has moved so that the output would fall below your minimum, the whole transaction reverts and you receive nothing — but pay the gas.
- Settlement. Done. The ETH is in your wallet, the swap is permanently recorded on chain.
There was no deposit, no withdrawal and no account. There was a gas fee paid to the network in its coin — a few cents on Solana or Base, potentially many dollars on Ethereum during congestion.
DEX versus CEX
| Centralised exchange | Decentralised exchange | |
|---|---|---|
| Holds your funds | The company | You, until the moment of the swap |
| Identity | Account, KYC | A wallet address |
| Price set by | Order book matching | Pool formula |
| Listing | Chosen by the exchange | Anyone, instantly |
| Fees | Trading fee to the exchange | Trading fee to liquidity providers, plus network gas |
| Failure mode | Exchange insolvency or hack | Contract bug, bad pool, user error |
| Volume data | Reported by the venue | Recorded on the public chain |
Neither is simply better. A CEX offers deep books for large coins, fiat rails and recourse. A DEX offers access to any token, no custody risk and no permission needed. Most active participants use both.
Why DEX volume is different data
Every swap is a transaction on a public ledger with its amounts, pool and timestamp. That means DEX volume does not have to be reported by anyone — it can be read from the chain and added up. Coinmico indexes swaps directly from the blockchains it covers, pool by pool, and values them in dollars at the time of each trade. The DEX rankings and chain rankings are built from that record.
This is the one part of the crypto market where "measured" and "true" volume coincide almost exactly. The caveat is wash trading, which is as possible on chain as off it — but it is visible, address by address, to anyone who looks.
UniswapUNIAcross 47 spot markets we indexWhat this means in practice
- On a DEX you are your own custodian right up to the swap. There is no support desk if you send to the wrong address or approve the wrong contract.
- The price you get depends on the pool's size relative to your trade. On a small pool, you are the market.
- On-chain volume is a record, not a report. It is the most trustworthy volume figure in crypto, and Coinmico builds its DEX figures from it directly.
Next in this track
The pool's formula decides every price on a DEX. The next lesson works through it with numbers, and explains what liquidity providers earn and risk.
Assets in this piece
Every figure here is measured by Coinmico across the venues and chains we index. See our methodology.




