On 2 November 2018, Hayden Adams deployed a small contract to the Ethereum mainnet and announced it to roughly 200 followers on Twitter. In July 2017 he had been laid off from his first job, as a mechanical engineer at Siemens. His contract had no order book, no listing team and no company holding anyone’s money: just two piles of tokens and a formula that set the price between them. That contract was Uniswap, and it became the template for the decentralized exchange (blockchain, where users swap tokens directly from their own wallets without handing custody of their funds to a company.">DEX) as most people use one today. As of 29 October 2026, DefiLlama counts 63.0 billion dollars of trades through the Uniswap family of contracts over the previous 30 days.
The idea was not his own, and he says so. In his 2019 history of the project, Adams credits Karl Floersch, then at the Ethereum Foundation: “At Karl’s suggestion I decided to implement an automated market maker, as described by Vitalik.” Vitalik Buterin had sketched the idea; Adams spent more than a year turning it into working code.
The formula is the easy part. What grew around it is harder: pools funded by strangers, fees split between those strangers and the protocol, Curve’s flatter curve for stablecoins, routers like Jupiter that own no smart contract holding reserves of two or more tokens, supplied by users, that a decentralized exchange uses to execute trades automatically at a price set by a formula.">pool at all, and order books that have moved back on-chain now that some chains are fast enough.
A decentralized exchange swaps from your wallet, not from an account
On a centralized exchange you open an account, pass identity checks, deposit funds and then trade a balance that the exchange keeps in its own wallets. Its matching engine pairs your order with someone else’s in an internal database. Our guide to how centralized exchanges work covers order books, matching and custody in detail.
A DEX turns that around. You connect a self-custody wallet and sign one transaction. In that transaction a smart contract takes your tokens and sends the other tokens back. If anything fails, the whole transaction is cancelled and you keep what you had, minus the network fee. There is no deposit step, no account and no balance held for you between trades.
That design removes one risk and adds others. The exchange cannot freeze or lose your funds because it never holds them. But nobody can reverse a mistaken trade either, and every swap costs gas fees paid to the network, whether the trade is for 20 dollars or 2 million.
One distinction matters from the start. The contracts live on the blockchain and anyone can call them. The website you use to reach them, the front end, is ordinary software run by a company or a team. Uniswap Labs runs an app; the Uniswap Protocol is the set of contracts. If the website goes offline, the contracts keep working for anyone who calls them another way.

Order book or pool: two ways to match a trade
An order book is a list of offers. Makers post bids and asks at prices they choose; a taker arrives and trades against the best offer. Prices exist only because someone keeps posting them, and professional market makers update their quotes many times a second. On Ethereum’s main chain, where every update is a paid transaction, that model was slow and expensive. Adams recalls that in 2017 EtherDelta was the only decentralized exchange with real traction, and that its interface felt messy to him.
An automated market maker (AMM) replaces the makers with a pool. Liquidity providers deposit two tokens into a contract, and that contract is the counterparty to every trade. Nobody posts a price. The contract computes it from the quantities it holds, so a quote exists at any moment, even at 3 a.m. on a Sunday with no professional trader awake.
The table below compares the main designs covered in this lesson.
| Design | Who sets the price | Who holds the funds | Example | Main risk for the user |
|---|---|---|---|---|
| CEX order book | Makers’ orders, matched by the exchange | The exchange | Coinbase, Kraken | Custody: the exchange can fail or freeze accounts |
| On-chain order book | Makers’ orders, matched by the chain | The protocol’s contracts and your wallet | Hyperliquid spot, Manifest | Thin books on small tokens; contract and chain risk |
| Constant-product AMM | A formula on the pool’s balances | Pool contract (LPs’ deposits) | Uniswap v2 | Price impact on large trades; contract risk |
| Concentrated-liquidity AMM | A formula, with liquidity placed in price ranges | Pool contract | Uniswap v3 and v4 | Same, plus LP positions that go out of range |
| Stable-asset AMM | A flatter formula for assets near the same price | Pool contract | Curve | A pool losing balance when one asset de-pegs |
| Aggregator | Not itself: it routes to the venues above | Your wallet, then the venues it uses | Jupiter, 1inch | Depends on each venue used; router contract risk |
How an automated market maker sets the price
One pool, one formula: x times y equals k
The first Uniswap pools used the simplest rule possible. Call x the quantity of one token in the pool and y the quantity of the other. The contract only accepts trades that leave their product, k, unchanged (before fees). The price is the ratio of the two piles.
Take an example pool, invented for this lesson and not a market quote: 100 ETH and 300,000 USDC. The product k is 30,000,000 and the starting price is 3,000 USDC per ETH. A trader sends 1,000 USDC. The pool now holds 301,000 USDC, so to keep k constant it may only keep 30,000,000 / 301,000 = 99.668 ETH. The trader receives the difference, 0.332 ETH, at an average price of about 3,010 USDC. After the trade, the pool’s price is 3,020 USDC per ETH.
The bigger the trade compared with the pool, the worse the average price. The same example pool gives these results, before any fee:
| Trade (USDC in) | ETH received | Average price paid (USDC) | Pool price after (USDC) | Average price vs 3,000 |
|---|---|---|---|---|
| 1,000 | 0.332 | 3,010 | 3,020 | +0.3% |
| 10,000 | 3.226 | 3,100 | 3,203 | +3.3% |
| 30,000 | 9.091 | 3,300 | 3,630 | +10.0% |
That gap is the price impact, and it is a property of the pool’s depth, not of anyone’s decision. A pool ten times larger would move ten times less for the same trade. On a real swap the fee comes first: with a 0.30% fee, only 997 of the 1,000 USDC enter the formula and the trader receives about 0.331 ETH. Your wallet then compares the result with the quote you saw, and the trade is refused if the difference exceeds your slippage tolerance.
Thin pools are where this hurts most. The previous lesson, on restaking and liquid restaking tokens, described 24 April 2024, when ezETH holders who could not redeem quickly sold into DEX pools too shallow to absorb them and the price fell well below ETH.
Why does the pool price stay close to the market? Arbitrage. After our trade the example pool values ETH at 3,020 USDC while other venues may still say 3,000. Anyone can sell ETH into the pool until the two prices meet, and bots do this within blocks. The AMM never looks at an outside price: traders bring the market to it. The full derivation of the curve, including why the price moves the way it does, is the subject of a later lesson on AMM math.
Liquidity providers and LP tokens
The tokens in a liquidity pool belong to its liquidity providers (LPs). In a Uniswap v2 pool, an LP deposits both tokens at the pool’s current ratio, for example 1 ETH and 3,000 USDC in the example pool above. The contract mints LP tokens in return, ordinary fungible tokens that represent a share of the whole pool. Withdrawing means returning the LP tokens and receiving that share of whatever the pool holds at that moment, which is rarely the same mix as the one deposited.
From version 3 onward, Uniswap stopped treating every LP the same way. Each deposit becomes a position with its own price range, so two positions in the same pool are no longer interchangeable. That change is described in the Uniswap section below.
The sum of all tokens sitting in a DEX’s pools is what dashboards report as its total staking or liquidity, measured at current market prices. It is the main size metric in DeFi.">value locked; that number moves with token prices even when nobody deposits anything.
Where the trading fees go
Fees are what pay LPs for the risk of holding a pool. According to Uniswap’s developer documentation, every v2 pool charges a flat 0.30% that is added to the pool’s reserves, so LPs’ shares grow automatically. Version 3 introduced fee tiers, with 0.05%, 0.30% and 1% as the standard ones; further tiers, such as 0.01%, can be enabled by UNI governance. Version 4 drops fixed tiers: a pool can charge anything from 0% to 100% and can change its fee from one swap to the next through a hook.
Until December 2025, all of those fees went to LPs. The UNIfication proposal changed that. The Block reported on 25 December 2025, citing Hayden Adams, that the governance vote passed with 99.9% support, more than 125 million UNI for and 742 against. Uniswap’s documentation now says protocol fees are active on all v2 pools and selected v3 pools, with the protocol taking about one sixth of the swap fee at launch: on a v2 pool, LPs receive 0.25% and the protocol 0.05%, while on the lowest v3 tiers the protocol’s cut is a quarter. The protocol’s share piles up in on-chain collection contracts, and anyone can claim it by burning a required amount of UNI, the governance token. The proposal also provided for a one-time burn of 100 million UNI after a two-day timelock, which The Block presented as an estimate of what the switch would have burned had it been on since launch.
LPs still keep most of the money. DefiLlama counts 85.75 million dollars of fees on Uniswap over the 30 days to 29 October 2026, of which 7.15 million counted as protocol revenue.
Impermanent loss in one paragraph
When the price of one token in a pool moves, arbitrageurs buy the token that became cheap in the pool and sell it the one that became expensive. The LP ends up holding more of the token that fell and less of the one that rose than if they had simply kept both in a wallet. That shortfall compared with holding is called impermanent loss. It is “impermanent” only because it disappears if prices return to where they were; withdrawing makes it permanent. Fees may or may not cover it. A later lesson on liquidity pools works through the numbers.
Uniswap, from v1 to hooks
Uniswap is the clearest way to follow how AMMs evolved, because each version fixed a weakness of the previous one.
Version 1 went live in November 2018 with the constant-product rule described above. Version 2 followed in May 2020 and allowed pools between any two ERC-20 tokens. Version 3 was announced on 23 March 2021, with launch on Ethereum set for 5 May. Its new idea, concentrated liquidity, lets each LP choose the price range in which their tokens can be traded. Uniswap’s own documentation illustrates the problem it solved: in a v2 DAI/USDC pool, only about 0.50% of the capital sat between 0.99 and 1.01 dollars, where nearly all trading happens. Uniswap claimed “up to 4000x capital efficiency relative to Uniswap v2”, a marketing figure that applies only to the narrowest ranges.
Concentration has a cost. The documentation says that once the price leaves a position’s range, that liquidity stops earning fees and the LP is left holding only one of the two tokens. A v3 position needs watching; a v2 deposit did not. Providing liquidity in ranges is covered by a later lesson.
Version 4 launched on 31 January 2025. According to Uniswap’s launch post, it went live on 10 chains after nine independent audits and with a 15.5 million dollar bug bounty. The design, first described in a June 2023 post, holds all pools in one singleton contract instead of one contract per pool, so a swap through several pools no longer moves tokens between contracts, and it transfers only net balances at the end of a transaction. Native ETH can be traded without wrapping it first. The headline feature is hooks, which the post describes as “modular plugins that allow developers to build custom logic for pools, swaps, fees, and LP positions”. A hook can set a dynamic fee, run a limit order or restrict who may trade a pool. The post counted more than 150 hooks already built at launch.
Twenty-one months later, v4 has taken the lead. DefiLlama shows Uniswap V4 at 31.9 billion dollars of volume over 30 days to 29 October 2026, ahead of V3 at 30.6 billion, while V2 handled 0.53 billion. In deposits the order is reversed: V3 holds 1.60 billion dollars, V4 1.25 billion and V2 0.90 billion.
Curve and the StableSwap curve for stablecoins
The constant-product curve is a poor fit for two tokens that should trade at the same price, such as USDC and USDT. It spreads liquidity over every possible price, from near zero to near infinity, when nearly all trading happens within a cent of 1 dollar.
Michael Egorov’s answer was a paper dated 10 November 2019, which became Curve. The StableSwap paper calls the design something that “could be called ‘Uniswap with leverage'”. It starts from two extremes. A constant-sum rule (x plus y equals a constant) would trade at exactly 1 to 1 with no price impact, but it can be drained entirely of one token. A constant-product rule never runs dry, but its price moves from the first dollar. StableSwap blends the two: near balance it behaves almost like constant sum, and as the pool becomes lopsided it bends toward constant product.
An amplification coefficient, A, sets the blend. The paper says the lower A is, the closer the curve is to constant product, and it uses A = 100 as a practical value, which it compares to using Uniswap with 100 times leverage. The catch is the de-peg: if one stablecoin loses its value, traders sell it into the pool and the pool fills up with the weaker coin.
Curve is now far smaller in trading than Uniswap but still large in deposits. As of 29 October 2026, DefiLlama shows 1.16 billion dollars locked in Curve DEX against 2.52 billion of volume over 30 days, and 354 billion since launch. Curve also issues its own stablecoin, crvUSD, and several of its pools were exploited in July 2023, two stories told in our earlier DeFi lessons.
Jupiter and 1inch: aggregators route trades, they hold no pool
Jupiter is often listed next to Uniswap and Curve, but it is not an AMM. It is a router on Solana. It holds no trading pool of its own. It looks at many venues, splits a trade across them when that gives a better result, and sends the order through. Jupiter’s documentation says its routing “combines multiple engines and selects the best execution price across all of them”.
Those engines are Metis, Jupiter’s on-chain router, which handles multi-hop, multi-split swaps across Solana DEXs; JupiterZ, a request-for-quote system in which market makers compete to fill an order with off-chain liquidity; and third-party sources, DFlow and OKX. Jupiter states that RFQ market makers often beat on-chain routes by 5 to 20 basis points on major pairs, a claim it does not back with published data. DefiLlama shows 12.9 billion dollars routed by Jupiter’s aggregator over 30 days to 29 October 2026, the most of any aggregator. Jupiter also runs a perpetual futures exchange and a lending market, separate products with their own risks.
1inch does the same job on Ethereum and other chains. Its classic mode searches DEX pools for the best route. Its Fusion mode, described in 1inch’s API documentation, works differently: the user signs an order whose rate falls step by step, a Dutch auction, from the desired rate toward a minimum. Third parties called resolvers compete to fill it and pay the gas themselves. That is an intent, a signed outcome rather than a route; the idea, also used by CoW Swap and UniswapX, is explained in our guide to cross-chain liquidity and intents.
Aggregator volume is large, but it is not extra volume. As of 29 October 2026, DefiLlama counts 64.2 billion dollars through aggregators over the 30 days to 29 October 2026: Jupiter 12.9 billion, DFlow 8.3, 0x 5.9, OKX Swap 5.9, KyberSwap 5.1, 1inch 3.15 and CoW Swap 3.0. Each of those trades is also counted again by the DEX it was routed to, so the two totals should never be added.
On-chain order books: Hyperliquid and Manifest
Fast, cheap chains have brought order books back on-chain. Hyperliquid runs its own blockchain, and its documentation says its book works much like a centralized exchange’s but is “fully on-chain”. Prices must be multiples of a tick size, sizes multiples of a lot size, and orders are matched in price-time priority: best price first, then first come, first served.
Hyperliquid is best known for perpetual futures, a different product from a spot swap. Its spot order book alone handled 3.61 billion dollars over the 30 days to 29 October 2026, according to DefiLlama. On Solana, Manifest, which DefiLlama describes as a successor to the Openbook and Serum order books, handled 3.77 billion.
The trade-off against a pool is clear. A book can quote tighter prices than a pool when professional makers are active, and the maker chooses the price instead of a formula. When the makers leave, there is nothing to trade against. A pool always has a price, even a bad one.
Decentralized exchange volume as of October 2026
DefiLlama’s DEX overview showed 245.7 billion dollars of volume over the 30 days to 29 October 2026, down 20.8% from the previous 30 days. That total needs care. The same overview includes venues that are not swap exchanges: 22.6 billion dollars of it comes from protocols DefiLlama classes as prediction markets, among them Kalshi and Polymarket, and smaller amounts from launchpads, bridges and trading apps. Protocols in the DEX category itself account for 206.3 billion. The figures below use that category.
| DEX (DefiLlama grouping) | Main chains | 30-day volume (billion dollars) | Note |
|---|---|---|---|
| Uniswap (v2, v3, v4) | Ethereum and other chains | 63.0 | V4 31.9, V3 30.6 |
| PancakeSwap | BNB Chain | 23.6 | AMM V3 15.8, Infinity 6.8 |
| Aero / Aerodrome | Base and others | 17.0 | Aerodrome Slipstream 13.5 |
| PumpSwap | Solana | 9.2 | AMM of the pump.fun launchpad |
| Orca | Solana | 7.5 | AMM |
| Raydium | Solana | 5.3 | AMM, TVL 1.13 billion |
| Manifest | Solana | 3.8 | On-chain order book |
| Hyperliquid spot | Hyperliquid L1 | 3.6 | On-chain order book |
| Curve | Ethereum and others | 2.5 | TVL 1.16 billion |
Source: DefiLlama, DEX category, 30 days to 29 October 2026. Uniswap’s three versions together took about 30% of the category’s 206.3 billion. PancakeSwap leads on BNB Chain, Aerodrome on Base and Raydium is one of several large AMMs on Solana.
By chain, Solana led over 30 days. Counting only protocols in DefiLlama’s DEX category, the figures are 54.5 billion dollars on Solana, 32.9 billion on Ethereum, 29.5 billion on Base, 25.8 billion on BNB Chain and 4.6 billion on Arbitrum, all for the 30 days to 29 October 2026.
How does that compare with centralized exchanges? The Block reported on 3 August 2026 that its DEX-to-CEX spot volume ratio closed July 2026 at a record 24%, up from 17% a year earlier. Two cautions apply. It is a ratio of DEX volume to CEX volume, not a share of all trading, and the article’s own headline ties the rise to sinking CEX volume rather than to a DEX boom. The article also gives a CEX dollar figure printed as “670 million” next to an annual high of 2.23 trillion, which cannot both be right, so no absolute CEX figure is used here. Other data providers have published different series, so “record” holds for The Block’s series only.

What can go wrong on a decentralized exchange
No custody risk does not mean no risk. Four problems come up again and again, and the next lesson on using a DEX safely turns them into practical checks.
Contract risk comes first. A bug in a pool or router contract can let an attacker drain it, audits or not. Uniswap’s v4 launch, with nine audits and a 15.5 million dollar bounty, shows how much effort large teams put into reducing that risk, not that the risk is gone.
Fake tokens are the second. Anyone can create a pool for any token, including one that copies the name and ticker of a real one. A DEX lists everything that has a pool, so checking the token’s contract address is the user’s job.
The third is execution. A large trade in a thin pool pays a heavy price impact, as the example table above shows, and a pending trade visible in the public queue can be “sandwiched” by bots that trade just before and just after it. That practice, part of what is called MEV, gets its own later lesson.
Last, the front end. A website can be copied or its domain hijacked to ask for approvals that empty a wallet. LPs carry two further risks of their own: impermanent loss and, in v3 and v4, positions that drift out of range and stop earning.
Rules for DEX users in the US and the UK
In the United States, the SEC proposed in March 2022 to widen the definition of an “exchange” under Exchange Act Rule 3b-16 to systems that bring together buyers and sellers through “communication protocols”, and reopened comment in April 2023. According to a Sullivan & Cromwell summary, the change would have reached many DeFi protocols. The SEC’s withdrawal notice, dated 12 June 2025 and effective 17 June, dropped it with a batch of other proposals. Earlier that year, on 25 February 2025, Uniswap Labs announced that the SEC had closed its investigation of the company with no action; the company says the agency’s 2024 Wells notice had alleged, among other things, that it operated an unregistered securities exchange. The SEC did not comment. The CFTC, which oversees derivatives, is the relevant agency for perpetual futures rather than spot swaps.
For tax, the IRS treats crypto as property, so swapping one token for another is generally a taxable disposal, measured in dollars at the time of the swap. Our guide to crypto taxes in the United States has the reporting details.
In the United Kingdom, the FCA published final rules for its cryptoasset regime on 30 June 2026. On its regime page, the FCA says the regime is “expected to come into force on 25 October 2027”; how it will treat services with no firm behind them is not settled on that page. HMRC treats exchanging one cryptoasset for another as a disposal for Capital Gains Tax.
The next lesson moves from how a DEX works to using one: a first swap on a testnet, slippage settings, token approvals and the checks that stop the most common losses.



