Skip to content
Reading depth

Each view includes the earlier layers; the complete engineer or auditor page is shown by default.

A decentralized exchange is a protocol that coordinates token trades through blockchain transactions rather than a single custodial exchange ledger.

Opposed arrows category cue

A decentralized exchange, or DEX, coordinates trades through blockchain transactions instead of recording every customer balance and trade inside one custodial exchange ledger.

Traders need a place to find counterparties, form prices, and settle asset exchanges. A DEX makes some or all of those rules programmable and inspectable, and lets settlement compose with other on-chain actions. It does not eliminate operators or trust by definition; it moves each responsibility to contracts, markets, solvers, relayers, interfaces, administrators, and the underlying chain.

A securities exchange or electronic trading venue is a useful analogy. The boundary is that a DEX may combine venue, custody, clearing, and settlement logic in one transaction while leaving order discovery, routing, sequencing, and interfaces elsewhere. “Decentralized” therefore needs a control map, not a logo or deployment address.

A protocol can combine several rows. The user-facing application, router, and settlement contracts can also be controlled by different parties.

The trader authorizes an order or swap. A maker, liquidity provider, or solver supplies the other side. Routers and settlement contracts select and execute a route. Validators, sequencers, and block builders order transactions. Governance or administrators may control fees, listings, upgrades, pauses, or frontends.

Input and output tokens are the core assets. An order, intent, partial fill, escrow balance, or pending withdrawal can create a temporary claim. Identify who owes settlement or refund and when that obligation ends.

  1. A trader specifies assets, direction, amount, recipient, and execution bounds.
  2. The venue discovers or receives executable liquidity.
  3. A router, matcher, solver, or direct caller proposes settlement.
  4. Contracts verify authorization, balances, prices, fees, and deadlines.
  5. Asset balances and any order state change together or under documented partial-fill rules.

Capital flow follows input, output, and fees. Information flow carries orders, quotes, routes, and reference prices. Claim flow records open or partially filled orders, refunds, LP positions, and other unsettled entitlements where the venue creates them. Return flow sends trader-paid fees, spreads, surplus, or explicit rewards to makers, LPs, solvers, or the protocol under venue rules. Control flow identifies who can include, match, route, pause, upgrade, or censor. Risk flow follows price movement, ordering, malicious tokens, bad routes, and failed settlement to the trader, maker, LP, solver, or protocol reserve that bears the loss.

DEX code does not create trading profit. Makers and LPs receive fees or spreads paid by traders; solvers may receive surplus or rewards under a settlement rule; arbitrageurs earn differences funded by prices and inventory across venues. Protocol incentives are token issuance, not the same source as trading fees.

Traders absorb poor execution within authorized bounds. Makers and LPs absorb inventory and adverse-selection losses. Solvers can bear failed-execution costs or penalties. A protocol treasury or insurer bears loss only when an explicit rule commits it.

Review signatures, nonces, approvals, amount and price bounds, partial fills, deadlines, recipients, callbacks, token behavior, fee accounting, route validation, replay domains, cancellation, upgrades, and emergency powers. Map which components are on-chain and which trust off-chain availability or data. Desired settlement properties are not proof that a deployed venue satisfies them.

Uniswap’s current architecture overview describes one AMM-based DEX family. CoW Protocol’s documentation describes a batch-auction and solver design. These primary examples, reviewed 2026-08-09, demonstrate that “DEX” is a venue category rather than one pricing mechanism; neither example establishes properties of every deployment, router, interface, or fork.

  • “DEX means AMM.” Order books, auctions, quotes, and solver systems are also decentralized-exchange mechanisms.
  • “Non-custodial means no trusted component.” Interfaces, routers, sequencers, solvers, administrators, and token issuers can still matter.
  • “A transaction proves a fair price.” It proves the accepted state transition, not that the economic terms were competitive or manipulation-free.

Continue with swaps and then compare the liquidity-pool path.

Machine-readable model

Key equations

Canonical expressions come from the structured concept record. KaTeX renders the notation, while the plain-text expression and variable table keep its meaning and units inspectable without JavaScript. Read the narrative above for the model's domain, assumptions, and rounding rules.

This concept does not require one canonical equation. Its mechanism and state transitions remain the authoritative explanation; do not invent a formula merely to make the topic look quantitative.

Assurance contract

Security properties

These structured statements define desired behavior. Their stable IDs can bind tests, invariants, specifications, audit findings, or proof results without turning descriptive review advice into an assurance claim.

Desired · not evaluated: No test, audit, or proof result is implied until scoped evidence is linked to this property.

  1. Settlement transfers no more than each participant authorized under the selected order or swap

  2. Failed execution cannot leave unaccounted partial asset or claim changes

  3. Price, amount, deadline, recipient, route, and fee bounds are enforced at settlement

  4. Privileged routing, pausing, upgrading, and fee powers are explicit and auditable

Knowledge check

Quiz

Answer in your own words, then open the model answer.

What problem does Decentralized exchange exist to address?

Model answer

Decentralized exchanges let participants trade while settlement and asset control follow programmable rules that can be inspected and composed with other protocols.