Decentralised Exchange (DEX): Definition, Types, and How They Work
Definition
A decentralised exchange (DEX) is a cryptocurrency trading platform that operates without a central authority, enabling peer-to-peer trading directly between users through smart contracts on a blockchain. Unlike centralised exchanges, which hold custody of user funds and operate order matching systems on proprietary infrastructure, DEXs execute trades through on-chain protocols that users interact with directly from their own wallets.
DEXs are a cornerstone of decentralised finance, providing permissionless access to token trading without the counterparty risk, identity requirements, or geographic restrictions associated with centralised platforms.
How DEXs Work
Smart Contract Architecture
A DEX’s core functionality is encoded in smart contracts — self-executing programmes deployed on a blockchain. These contracts define the rules for:
- How trades are priced and executed
- How liquidity is provided and managed
- How fees are collected and distributed
- How governance decisions are implemented
Users interact with DEX smart contracts by connecting their wallets and submitting transactions to the blockchain. The smart contract executes the trade atomically — the swap either completes fully or fails entirely, with no partial fills or pending states.
Non-Custodial Trading
The defining characteristic of DEXs is non-custodial operation. Users maintain control of their assets at all times — tokens remain in the user’s wallet until the moment of the swap and are returned immediately upon execution. There is no deposit or withdrawal process, and no exchange-controlled account to be frozen, hacked, or mismanaged.
This non-custodial model eliminates exchange counterparty risk — one of the most significant risks in the digital asset market, as demonstrated by the failure of several major centralised exchanges.
Types of DEXs
AMM-Based DEXs
The most common DEX model uses automated market makers paired with liquidity pools to facilitate trading. Rather than matching individual orders, AMM DEXs allow traders to swap tokens against pooled reserves at prices determined by mathematical formulas.
Key examples include Uniswap, Curve, and Balancer on Ethereum, along with similar protocols on other blockchains.
Advantages: Always-available liquidity, simple user experience, permissionless pool creation Disadvantages: Slippage on large orders, impermanent loss for liquidity providers, limited order types
Order Book DEXs
Some DEXs operate traditional order book models on-chain or in hybrid architectures. These exchanges match limit orders from individual users, providing the familiar trading experience of centralised exchanges with the self-custody benefits of decentralised operation.
On-chain order books face challenges with transaction costs and latency, as every order submission and cancellation requires a blockchain transaction. To address this, some order book DEXs use off-chain order matching with on-chain settlement, creating a hybrid architecture.
Advantages: Familiar trading interface, limit orders, no impermanent loss Disadvantages: Lower liquidity than AMM pools for many pairs, higher gas costs for on-chain models
DEX Aggregators
DEX aggregators are not DEXs themselves but routing layers that find the optimal execution path across multiple DEXs and liquidity pools. When a user submits a trade, the aggregator analyses available liquidity across all connected protocols and splits the order across multiple sources to achieve the best price.
Aggregators are particularly valuable for larger trades where splitting across multiple liquidity sources reduces total slippage.
Hybrid DEXs
Emerging DEX designs combine elements of AMMs and order books, allowing limit orders to be placed alongside AMM liquidity. These hybrid models aim to offer the always-on liquidity of AMMs with the precision and capital efficiency of order book trading.
DEX vs Centralised Exchange
| Feature | DEX | Centralised Exchange |
|---|---|---|
| Custody | Non-custodial (user holds keys) | Custodial (exchange holds funds) |
| Identity | Pseudonymous | KYC required |
| Access | Permissionless, global | May be restricted by jurisdiction |
| Listing | Permissionless (anyone can create a pool) | Curated listing process |
| Speed | Blockchain-dependent (seconds to minutes) | Near-instant |
| Fees | Gas costs + protocol fees | Trading fees (typically lower) |
| Liquidity | Concentrated in major pairs, fragmented elsewhere | Generally deeper for major pairs |
| Regulation | Limited regulatory clarity | Subject to licensing requirements |
| Counterparty risk | Smart contract risk only | Exchange operational and solvency risk |
Trading on a DEX
Wallet Connection
DEX trading begins with connecting a self-custody wallet (such as MetaMask, WalletConnect, or a hardware wallet) to the DEX interface. The wallet holds the user’s tokens and signs transactions authorising swaps.
Token Approval
Before trading a token for the first time on a DEX, the user must approve the DEX smart contract to access that token. This approval transaction is separate from the trade and requires a blockchain transaction with associated gas costs.
Swap Execution
The user selects the input and output tokens, specifies the trade amount, and reviews the estimated output and slippage. Upon confirmation, the wallet signs the transaction, which is broadcast to the blockchain. Once confirmed, the swap is executed atomically.
Gas Costs
Every DEX transaction requires payment of blockchain gas fees. These costs vary significantly based on network congestion and blockchain choice. Ethereum gas costs can make small trades economically impractical, driving users to Layer 2 solutions and alternative blockchains with lower transaction costs.
Risks
Smart Contract Risk
All assets interacting with a DEX are exposed to the smart contract code. Bugs, vulnerabilities, or exploits in the contract can result in loss of funds. Audited, battle-tested protocols with significant total value locked (TVL) are generally considered safer, but no smart contract is risk-free.
Impermanent Loss
Liquidity providers face impermanent loss when the prices of pooled assets diverge. This risk is inherent to AMM-based DEXs and must be carefully managed.
Front-Running and MEV
DEX transactions in the public mempool are visible before execution, enabling front-running and sandwich attacks. These practices extract value from traders and represent a significant cost in high-congestion environments.
Fake Tokens
The permissionless nature of DEXs means anyone can create a token and a liquidity pool. Malicious actors exploit this to create fake tokens that mimic legitimate projects, scam tokens designed to trap buyers, or rug pull tokens where liquidity is removed after attracting deposits.
Regulatory Uncertainty
The regulatory treatment of DEXs varies by jurisdiction and remains unsettled in many markets. Swiss businesses interacting with DEXs should assess their regulatory obligations under FINMA guidance.
DEXs in the Swiss Market
Swiss institutional interest in DEX trading is growing, particularly for:
- DeFi token access — Many tokens are initially available only on DEXs before centralised exchange listing
- Execution diversification — DEX liquidity represents an additional venue for OTC desks and trading firms
- Self-custody trading — Institutions seeking to avoid exchange counterparty risk can trade directly from custodied wallets
The regulatory framework for DEX interaction by Swiss entities is addressed through FINMA’s DeFi guidance, which focuses on the economic substance of activities rather than the technology used. For a detailed comparison of DEX and centralised exchange trading in the Swiss context, see our DEX vs CEX analysis.
Donovan Vanderbilt is a contributing editor at ZUG TRADING, a digital asset trading and exchanges intelligence publication by The Vanderbilt Portfolio AG, Zurich. His analysis covers institutional market structure, OTC liquidity, and regulatory developments across Swiss and global digital asset markets.