Guides › Exchanges

Uniswap

Trades Ethereum and its tokens on Ethereum itself, in one transaction.

Simple

Uniswap trades Ethereum and the tokens built on it — and only those. It isn't a cross-chain network: everything happens on Ethereum, which is what makes it different from the others.

It is a program running on Ethereum rather than a company. Anybody can put two coins into a pool and earn a share of the fees from people trading against it, and anybody can trade against it.

What it means for you

A swap through it is a single Ethereum transaction. There is no waiting for a deposit to be noticed by anyone, so it either works within a block or two, or it fails and you keep your coins — minus the Ethereum fee for trying.

Because it all happens in one transaction, the amount you receive is guaranteed before it goes through. If the price moved enough that you'd get less than you agreed to, the transaction simply doesn't happen.

What it costs depends mostly on how busy Ethereum is at that moment, not on the size of your trade. That makes it good value for larger swaps and poor value for very small ones.

The first time you trade a particular token, there's an extra step to give permission to move it. It costs a small Ethereum fee of its own.

Detailed

An exchange that is a program

There is no operator and no deposit. A pool is a contract holding two tokens; a trade is a call to it that takes some of one and leaves some of the other, priced by a formula that depends only on what the pool currently holds. Anyone can create a pool for any pair, so the catalogue is permissionless and the quality varies enormously.

Atomic settlement

The whole swap — possibly across several pools — succeeds or fails as a unit, inside one transaction. This is the central advantage over any cross-chain design: there is no window in which you hold a half-finished trade, and the minimum output you specify is enforced by the contract itself rather than promised.

Fee tiers and depth

The same pair can have several pools with different fee levels. A stable pair can be served well by a very low fee, while a volatile pair needs a higher one to pay the people providing liquidity for the risk they take. A router picks a path across pools; the headline rate alone doesn't say which is cheapest, because a lower fee on a thin pool can cost more in price impact than a higher fee on a deep one.

Approvals

Moving an existing token requires giving a contract permission to do so first, which is a separate transaction. It is worth knowing this is an allowance rather than a one-off: it stays until changed, which is both a convenience and something worth keeping an eye on.

What a swap costs

  • Ethereum's own fee for the transaction, which dominates for small trades.
  • The pool's fee, a fixed share of the amount traded.
  • Price impact, which depends on your size against the pool's depth.
  • A separate Ethereum fee for an approval, when one is needed.

In depth

Constant product and its descendants

The original rule keeps the product of reserves fixed across a trade:

x · y = k

An input Δx returns Δy = y·Δx/(x+Δx) before fees. The marginal price is y/x and the realised price is always worse, with the gap growing as Δx/x — this is price impact, and it is a property of the formula, not a charge by anyone. Liquidity under this rule is spread over every price from zero to infinity, most of which will never trade, so capital efficiency is poor.

Concentrated liquidity

Later designs let a provider choose a price range and supply liquidity only inside it, behaving within that range like a constant-product pool holding much larger virtual reserves. Capital efficiency improves by orders of magnitude for a pair that stays in range, and the provider is left holding only one of the two assets when it leaves. Aggregate depth therefore becomes a function of price — a pool can be very deep at the current price and thin a few percent away, which is invisible in any single quoted rate.

Impermanent loss as a cost of providing

A provider's holding is rebalanced continuously against the market by the traders themselves, so it ends up with more of whichever asset fell. Against simply holding the two assets, the shortfall for a constant-product pool at a price ratio r is

1 − 2·√r / (1 + r)

which is zero when the price returns and grows either side of it. Fee income has to exceed this for providing to be worthwhile, which is why fee tiers track volatility.

Ordering and extractable value

Because trades settle in a public ordered sequence, whoever decides the order can profit from knowing a trade before it executes: placing one in front and one behind it captures the price it moves. The minimum-output bound is the user's defence, and it converts a worse price into a failed transaction rather than preventing the extraction. Private transaction routing avoids the public queue, at the cost of relying on whoever carries it to include it at all — a dropped transaction is the characteristic failure of that approach, and the reason it must be detected rather than waited on indefinitely.

Path selection

Finding the best execution is an optimisation over paths and splits, not a lookup: a large trade may be best served split across several pools and several hops, since impact is superlinear in size within each. The comparison that matters is always the output after all fees and impact, which is why two routers quoting the same pair can honestly differ.