# What Is a Decentralized Exchange (DEX) and How Does It Work?

![Person reviewing a token swap on a laptop beside a smartphone showing a Terenval-branded wallet screen](hero.webp)

**A decentralized exchange (DEX) is a crypto trading system that uses blockchain-based settlement to exchange assets.** In a typical wallet-based token swap, you authorize the trade from your own wallet, and smart contracts enforce the exchange conditions instead of a centralized company maintaining your trading balance.

For example, you might exchange an Ethereum token for a stablecoin. The trading interface obtains a quote, your wallet requests authorization, and the protocol settles the exchange if its conditions are met.

> **Short answer:** A typical DEX swap follows **choose tokens and network → review the quote → authorize any required spending permission → confirm the trade → verify the result on-chain**. The important checks are what you spend, what you receive, who can spend your tokens, and what the complete transaction costs.

This guide focuses on spot token swaps, using Ethereum and compatible networks for examples. Decentralized derivatives exchanges and cross-chain trading systems can have different custody, collateral, and settlement arrangements.

## Key Takeaways

- **A DEX and a wallet do different jobs.** The exchange arranges a trade; the wallet helps you authorize actions and manage access to your assets.
- **DEXs do not all use the same market design.** Liquidity pools, order books, and signed orders filled by third parties are different approaches.
- **Self-custody changes the risks.** It reduces reliance on an exchange holding your trading balance, while leaving contract, token, permission, and execution risks to assess.
- **Price impact, slippage, and fees are separate concepts.** Compare the actual output and total costs rather than one headline percentage.
- **An approval can outlast the swap.** A failed trade or disconnected website does not automatically remove earlier spending permissions.
- **A token appearing on a DEX is not an endorsement.** Confirm its network and contract address, and investigate restrictions or warnings.

## What Does a DEX Actually Do?

A DEX provides a way to exchange assets under a protocol's rules. A common use is swapping one token for another without first depositing both into an exchange-operated account.

Three parts are easy to confuse:

| Component | Its role | What the user checks |
|---|---|---|
| Trading interface | Displays assets, obtains quotes, and prepares requests | Official website, token details, route, and quote |
| Exchange protocol | Defines how orders or swaps are executed and settled | Contracts, market design, permissions, and controls |
| Crypto wallet | Presents signing requests and authorizes account actions | Correct account, network, spending authority, and transaction |

The website is an access point to the protocol. Its availability and restrictions can differ from those of the underlying contracts. A familiar interface also cannot make an unsafe token safe.

DEXs are one part of decentralized finance. See [What Is DeFi and How Does It Work?](https://wallet.terenval.com/answers/what-is-defi-and-how-does-it-work/) for the wider context, and [Ethereum.org's DeFi overview](https://ethereum.org/defi/) for examples of blockchain-based financial applications.

## DEX vs CEX: What Is the Difference?

**The main distinction is how trading assets are controlled and how trades settle.** A conventional centralized exchange (CEX) holds customer assets and tracks trading balances internally. A typical spot DEX lets a user authorize an exchange from a self-custody wallet, with settlement enforced on-chain.

[Coinbase's custody explanation](https://help.coinbase.com/en/coinbase/other-topics/legal-policies/what-does-coinbase-do-with-my-digital-assets) illustrates the hosted exchange-account model and distinguishes it from a self-custody wallet.

| Question | Typical centralized exchange | Typical wallet-based spot DEX |
|---|---|---|
| Where is the trading balance? | In an account managed by the exchange | In the user's wallet until spent or committed under protocol rules |
| Who authorizes activity? | The user instructs the exchange through an account | The user signs transactions or orders with a wallet |
| How does a trade settle? | Usually through the exchange's internal accounting | Through blockchain transactions and protocol rules |
| How is the price found? | Commonly an order book or quoted trading service | A pool, order book, auction, or other liquidity source |
| Which costs matter? | Trading charges, spreads, and relevant funding or withdrawal costs | Trading charges, network costs, and execution quality |
| Who handles recovery? | An operator may help recover account access | Wallet recovery depends on the user's recovery setup |

These are common patterns, not universal product definitions. A DEX can require assets to be deposited into a contract or trading account. A centralized service can also offer a separate DEX interface. Examine the particular transaction rather than relying on a brand label.

## How Do Decentralized Exchanges Find a Price?

### Automated market makers and liquidity pools

An **automated market maker (AMM)** uses rules to price trades against liquidity supplied to a pool. The trader exchanges assets with the pool instead of waiting for another person to place an exactly matching order.

A basic constant-product model uses `x × y = k`, where `x` and `y` represent the two token reserves. Ignoring fees, removing one token requires adding enough of the other to preserve the product. The available exchange rate therefore changes as reserves change.

[Uniswap's explanation of its AMM](https://developers.uniswap.org/docs/get-started/concepts/how-uniswap-works) describes this mechanism. It is a useful starting point, but not a formula for every DEX. Different pool designs can concentrate liquidity within price ranges or use different pricing rules.

### Order books

An **order book** organizes buy and sell orders by price. Matching rules determine which orders trade, and the system settles the resulting exchanges.

Order books are not exclusive to centralized exchanges. For example, [dYdX Chain documents a distributed order book and matching process](https://docs.dydx.exchange/concepts-limit-order-book-and-matching). Its derivatives trading model differs from the spot token swaps used elsewhere in this guide.

### Signed orders and solvers

In an **intent-based** system, a user signs the conditions of an acceptable trade. Third parties, often called solvers, compete to find an execution path that satisfies those conditions.

[CoW Protocol](https://docs.cow.fi/cow-protocol) describes a design that groups trade intents into auctions and draws on multiple liquidity sources. Signing an order and submitting a swap transaction are different workflows; both can authorize assets to move.

### What is a DEX aggregator?

A **DEX aggregator** compares or combines liquidity sources to construct a trading route. That route may split a trade or pass through an intermediate token.

Routing also happens within an individual exchange ecosystem. [Uniswap's routing guide](https://support.uniswap.org/hc/en-us/articles/46932289118733-How-does-routing-work) explains why additional pools can improve the quote while adding execution costs. More steps are useful only when their benefit outweighs those costs.

## How Does a DEX Swap Work Step by Step?

Consider a same-network swap from an ERC-20 token to another supported token:

1. **Choose the correct interface and network.** Check the official domain and confirm where the input assets actually exist.
2. **Connect a compatible wallet.** Select the intended account and review the connection request.
3. **Choose the tokens and amount.** Verify contract addresses through trustworthy project information, especially for unfamiliar assets.
4. **Review the quote.** Look at expected output, minimum output or order limit, route, fees, and price impact.
5. **Review spending permission if requested.** A token approval or permit may be needed before the trade can spend the input token.
6. **Authorize the trade.** Depending on the design, this means signing a transaction or a trade order. Read each request separately.
7. **Check settlement.** Confirm the transaction status, output token, recipient account, and network. A submitted request is not yet a completed exchange.

[Uniswap's swap documentation](https://developers.uniswap.org/docs/get-started/concepts/traders/swaps) explains pool-based execution. Other DEX models may combine steps or use different authorization methods.

For the connection itself, read [What Is WalletConnect and How Does It Connect a Wallet to a dApp?](https://wallet.terenval.com/answers/what-is-walletconnect-and-how-it-connects-wallet-to-dapp/). For the receipt, use [What Is a Transaction Hash or TXID and How Do You Use It?](https://wallet.terenval.com/answers/transaction-hash-txid-how-to-use-it/).

## Price Impact vs Slippage vs Fees

**Price impact is the effect of your trade on the market price. Slippage is the difference between the quoted or expected execution and the execution you actually receive. Fees are charges for services or network resources.**

These can affect the same trade without being interchangeable. [Uniswap Labs distinguishes price impact from slippage](https://support.uniswap.org/hc/en-us/articles/8643794102669-Price-Impact-vs-Price-Slippage); its [slippage settings guide](https://support.uniswap.org/hc/en-us/articles/8643879653261-How-to-change-slippage-on-the-Uniswap-Web-app) explains the trade-off between execution tolerance and failed swaps.

| Term | What it means for a swap | Practical implication |
|---|---|---|
| Price impact | Your trade moves the available price as it consumes liquidity | A large order in a shallow market can receive a poor quote immediately |
| Slippage | Actual execution differs from the quote | Conditions can change while the transaction or order waits |
| Slippage tolerance | The adverse execution change you allow | A wider setting accepts a worse outcome; it does not improve liquidity |
| Trading fee | A charge associated with the swap or route | Check whether it is already included in the displayed output |
| Network fee | The cost of processing a blockchain transaction | It can be charged separately from the traded amount |

Increasing slippage tolerance does not repair a bad quoted price. It allows more deviation from that quote. A minimum-output condition also protects an amount of the specified token, not its future market value or legitimacy.

### Example: reading a swap quote

Suppose a hypothetical same-network swap spends **100 units of Token A** and quotes **99.50 units of Token B**, after trading charges already included in that quote. These are invented units for explanation, not live prices or a recommended trade.

For an interface that applies a **1% tolerance directly to quoted output**, the illustrative minimum is:

**99.50 × (1 − 0.01) = 98.505 units of Token B.**

| Quote item | Illustrative value | Meaning |
|---|---|---|
| Input | 100 Token A | Amount offered for exchange |
| Expected output | 99.50 Token B | Current quote under the stated assumptions |
| Minimum output | 98.505 Token B | Lower bound for this example's successful swap |
| Network fee | Shown separately in the network's fee asset | Additional processing cost |

If the route would deliver only 98.40 Token B, a correctly implemented swap enforcing that minimum should revert. An included reverting transaction can still cost gas. If it delivers 99.20 Token B, it satisfies the minimum even though the result is below the original quote.

Actual interfaces can calculate and round limits differently. Review the minimum output or signed order conditions shown for your trade. Do not subtract an included trading fee a second time when comparing quotes.

## What Fees Do You Pay on a DEX?

**The full cost can include a pool or trading fee, an interface or service fee where applicable, and network fees.** The number of approvals and transactions also matters.

[Uniswap's fee documentation](https://developers.uniswap.org/docs/get-started/concepts/fees) shows why there is no single fee percentage that describes every pool or protocol version. Use the current quote for the route you are actually considering.

On Ethereum, ordinary transactions use ETH for gas. Having enough of the token you want to swap does not necessarily mean you have enough of the network's fee asset. Keep a fee reserve when spending the native asset itself.

Some services sponsor transaction submission or recover execution costs through the trade. A “gasless” signing experience does not necessarily mean that the complete service is free.

[Ethereum's gas documentation](https://ethereum.org/developers/docs/gas/) explains the execution costs behind transactions. For a wallet fee shortfall, see [What Does “Insufficient Funds for Gas” Mean?](https://wallet.terenval.com/answers/insufficient-funds-for-gas-meaning/).

## Does Connecting a Wallet Give a DEX Access to Your Funds?

**A basic wallet connection normally shares account information and enables requests; it does not itself grant unlimited spending rights.** A subsequent approval, signature, or transaction can grant authority, so evaluate each prompt.

An ERC-20 **allowance** permits a specified spender to transfer up to an authorized amount of a particular token. The [ERC-20 standard](https://eips.ethereum.org/EIPS/eip-20) defines this permission separately from a transfer.

If an approval succeeds and a later swap fails, the approval can remain. A large unused allowance can also apply to future receipts of that token. It is not ordinarily permission to spend every unrelated asset in the wallet.

Some workflows use signed permits. [ERC-2612](https://eips.ethereum.org/EIPS/eip-2612) defines token allowances authorized by a signed message; [Permit2](https://support.uniswap.org/hc/en-us/articles/39683402190733-What-is-a-Permit2-approval) uses a separate approval system. A signature can authorize spending even when no gas payment appears at that moment.

Check the token, spender, amount, network, and expiration where applicable. Disconnecting the website does not revoke on-chain permissions. Changing an allowance also does not necessarily invalidate every outstanding signed authorization.

See [How Do You Revoke Token Approvals After Using a dApp?](https://wallet.terenval.com/answers/revoke-token-approvals-after-using-dapp/) for the separate permission-management workflow.

## What Are the Main DEX Risks?

### Fake tokens and restricted selling

Anyone being able to create a market does not mean every listed asset has passed a quality review. Token names and symbols can be copied. Malicious tokens may restrict selling or impose severe transfer charges.

[Uniswap's token-warning documentation](https://support.uniswap.org/hc/en-us/articles/8723118437133-What-are-token-warnings) covers impersonators, honeypots, and other warning types. It also explains that warning data can be incomplete. The absence of an alert is not proof of safety.

### Contract defects and administrative powers

An exchange route can involve several contracts. Defects, compromised components, or privileged controls can affect the result even when the wallet is functioning correctly.

Review the actual deployment and audit scope. [Ethereum's security guidance](https://ethereum.org/developers/docs/smart-contracts/security/) treats audits as one layer of review, not a guarantee. Our [smart contract risk guide](https://wallet.terenval.com/answers/evaluate-smart-contract-risk-before-using-defi-app/) explains the relevant checks in more detail.

### Thin liquidity and adverse transaction ordering

A trade can suffer from shallow liquidity or price changes while it waits. Public pending trades can also be targeted by **sandwich attacks**, in which other trades are placed around the user's trade to extract value from its price effect.

[Ethereum's MEV documentation](https://ethereum.org/developers/docs/mev/) explains this transaction-ordering risk. Protective routing and private submission mechanisms can change exposure, but their properties depend on the implementation. A broad slippage limit is not a substitute for checking execution quality.

### Phishing and harmful requests

A copied exchange website can request a malicious signature or approval. Verify the domain independently, and never enter a seed phrase into a DEX website to “connect” or “validate” a wallet.

Wallet connection should not require disclosing the wallet's recovery secret. A small test swap can confirm an operational path, but it cannot certify the contracts, token, or later transactions as safe.

## Is a DEX Swap the Same as Bridging?

**No. A same-network swap changes the asset you hold; a bridge moves value or messages between networks.** An application may combine both operations under one interface, adding more dependencies and potentially more settlement steps.

ETH on Ethereum Mainnet and ETH on an L2 are balances on different networks. Similarly, a token representing bitcoin on Ethereum is not native BTC on the Bitcoin blockchain.

[Ethereum's bridge guide](https://ethereum.org/bridges/) explains these distinctions and the additional trust assumptions. Before accepting a cross-chain quote, check the destination network, the exact output asset, expected settlement, and what happens if one stage fails.

For asset-specific context, see [What Is a Stablecoin?](https://wallet.terenval.com/answers/what-is-a-stablecoin/). A familiar ticker alone does not establish that two network deployments have the same backing or redemption mechanism.

## Where Does Terenval Wallet Fit Into a DEX Workflow?

**Terenval Wallet gives Android users a self-custody wallet for Bitcoin, Ethereum, and supported EVM Layer 2 networks, with WalletConnect for compatible dApps.** Its [official product description](https://terenval.com/) covers creating or importing a wallet, sending and receiving assets, and reviewing connection and signing requests.

For someone learning to use a DEX, that makes the wallet the place to manage the account and authorize compatible requests. Start by confirming the network and assets you need, then check the chosen dApp's compatibility with the current wallet version.

**[Open and install Terenval Wallet on Android](https://wallet.terenval.com/?lang=en)** to create a wallet or import one you control. Installation uses a supported browser's install or add-to-home-screen flow. Back up a new wallet's recovery information before funding it, and verify the official domain before importing an existing wallet.

The wallet, DEX, and token remain separate parts of the transaction. Terenval's support for a network or connection method does not certify a third-party market or guarantee a particular exchange rate.

## What Should You Check Before Your First DEX Swap?

Before signing, make sure you can answer these questions:

1. **Identity:** Am I using the intended website and token contracts?
2. **Network:** Are my funds, fee asset, and intended output on the correct network?
3. **Permission:** Which contract may spend which token, for how much, and for how long?
4. **Execution:** What output is quoted, what is the minimum, and is the price impact acceptable?
5. **Cost:** Which charges are already included, and which are paid separately?
6. **Scope:** Is this a simple swap, or does it also bridge, deposit collateral, or add liquidity?
7. **Verification:** Can I identify the recipient and inspect the resulting transaction?

If a prompt does not match the intended action, pause before authorizing it. Understanding the request matters more than completing the sequence of buttons.

## Decentralized Exchange FAQ

### Is a DEX the same as a crypto wallet?

No. A DEX provides trading and settlement mechanisms. A wallet manages access to accounts and helps authorize actions. A wallet can integrate a swap interface, but the underlying exchange route still has its own contracts and costs.

### Do all DEXs use liquidity pools?

No. AMMs use pools, while other systems use order books, signed orders, auctions, or combinations of these. “Decentralized” describes aspects of control and operation, not one universal pricing formula.

### Do you need to provide liquidity to swap?

No. A trader can exchange tokens against existing liquidity without becoming a liquidity provider. Providing liquidity is a separate commitment with different risks and responsibilities. [Uniswap's liquidity overview](https://developers.uniswap.org/docs/liquidity/overview) explains how pool positions differ from ordinary swaps.

### Can you lose money on a DEX even if the swap succeeds?

Yes. Successful execution means the transaction met its programmed conditions. The purchased token can lose value, the quoted exchange rate can be unfavorable, and fees can outweigh a small trade's economic benefit.

### Why did my swap fail after I approved the token?

Approval grants permission; it does not guarantee a later trade. Changed prices, insufficient fee funds, an expired deadline, or unsupported token behavior can prevent execution. [Uniswap's failure guide](https://support.uniswap.org/hc/en-us/articles/8643975058829-Why-did-my-transaction-fail) describes these cases. The earlier allowance may still exist.

### Can I reverse a completed DEX swap?

You generally cannot undo a successfully settled swap. Exchanging back is a new trade with its own price, liquidity requirements, and fees. An unfilled order may have a cancellation mechanism, which differs from reversing a completed transaction.

### Can I use native Bitcoin in an Ethereum token pool?

Native BTC belongs to the Bitcoin network and cannot be spent directly by an ordinary Ethereum token-pool contract. An Ethereum-based representation of BTC is a separate token with its own backing and custody assumptions. Cross-chain systems require additional mechanisms.

### Does a DEX guarantee the best price?

No. The result depends on available liquidity, route, trade size, fees, and execution timing. An aggregator can compare sources, but its quote still has a scope and assumptions. Compare net results for the same asset, amount, and network.

## Related Terenval Reading

- [What Is DeFi and How Does It Work?](https://wallet.terenval.com/answers/what-is-defi-and-how-does-it-work/)
- [What Is a Stablecoin?](https://wallet.terenval.com/answers/what-is-a-stablecoin/)
- [What Is a Smart Contract and How Does It Work?](https://wallet.terenval.com/answers/what-is-a-smart-contract-and-how-does-it-work/)
- [How Do You Evaluate Smart Contract Risk Before Using a DeFi App?](https://wallet.terenval.com/answers/evaluate-smart-contract-risk-before-using-defi-app/)
- [How Do You Revoke Token Approvals After Using a dApp?](https://wallet.terenval.com/answers/revoke-token-approvals-after-using-dapp/)

## Sources and Further Reading

- [Ethereum.org — Decentralized finance](https://ethereum.org/defi/)
- [Uniswap — How Uniswap works](https://developers.uniswap.org/docs/get-started/concepts/how-uniswap-works)
- [Uniswap — Understanding swaps](https://developers.uniswap.org/docs/get-started/concepts/traders/swaps)
- [dYdX — Limit order book and matching](https://docs.dydx.exchange/concepts-limit-order-book-and-matching)
- [CoW Protocol — Protocol overview](https://docs.cow.fi/cow-protocol)
- [Uniswap Labs — How routing works](https://support.uniswap.org/hc/en-us/articles/46932289118733-How-does-routing-work)
- [Coinbase — Custody of digital assets](https://help.coinbase.com/en/coinbase/other-topics/legal-policies/what-does-coinbase-do-with-my-digital-assets)
- [Uniswap Labs — Price impact vs price slippage](https://support.uniswap.org/hc/en-us/articles/8643794102669-Price-Impact-vs-Price-Slippage)
- [Uniswap Labs — Slippage settings](https://support.uniswap.org/hc/en-us/articles/8643879653261-How-to-change-slippage-on-the-Uniswap-Web-app)
- [Uniswap — Fees](https://developers.uniswap.org/docs/get-started/concepts/fees)
- [Ethereum.org — Gas and fees](https://ethereum.org/developers/docs/gas/)
- [ERC-20 — Token standard](https://eips.ethereum.org/EIPS/eip-20)
- [ERC-2612 — Signed token approvals](https://eips.ethereum.org/EIPS/eip-2612)
- [Uniswap Labs — Permit2 approvals](https://support.uniswap.org/hc/en-us/articles/39683402190733-What-is-a-Permit2-approval)
- [Uniswap Labs — Transaction failures](https://support.uniswap.org/hc/en-us/articles/8643975058829-Why-did-my-transaction-fail)
- [Uniswap Labs — Token warnings](https://support.uniswap.org/hc/en-us/articles/8723118437133-What-are-token-warnings)
- [Ethereum.org — Maximal extractable value](https://ethereum.org/developers/docs/mev/)
- [Ethereum.org — Smart contract security](https://ethereum.org/developers/docs/smart-contracts/security/)
- [Ethereum.org — Blockchain bridges](https://ethereum.org/bridges/)
- [Uniswap — Liquidity overview](https://developers.uniswap.org/docs/liquidity/overview)
- [Terenval — Official wallet features](https://terenval.com/) — first-party source for product capabilities.

---

**Editorial note:** This educational guide was prepared by Terenval, the wallet provider mentioned in the article. Technical references were checked on October 15, 2026. The numerical example is hypothetical; protocol examples explain different designs and are not endorsements. Check current fees, deployments, and compatibility before using a service.

## Editorial & technical review

- Published by: Terenval
- Technical review: Terenval Wallet team
- Last reviewed: 2026-10-15

## Sources

- [Ethereum.org — Decentralized Finance](https://ethereum.org/defi/)
- [Uniswap — How Uniswap Works](https://developers.uniswap.org/docs/get-started/concepts/how-uniswap-works)
- [Uniswap — Understanding Swaps](https://developers.uniswap.org/docs/get-started/concepts/traders/swaps)
- [dYdX — Limit Order Book and Matching](https://docs.dydx.exchange/concepts-limit-order-book-and-matching)
- [CoW Protocol — Protocol Overview](https://docs.cow.fi/cow-protocol)
- [Uniswap Labs — How Routing Works](https://support.uniswap.org/hc/en-us/articles/46932289118733-How-does-routing-work)
- [Coinbase — Custody of Digital Assets](https://help.coinbase.com/en/coinbase/other-topics/legal-policies/what-does-coinbase-do-with-my-digital-assets)
- [Uniswap Labs — Price Impact vs Price Slippage](https://support.uniswap.org/hc/en-us/articles/8643794102669-Price-Impact-vs-Price-Slippage)
- [Uniswap Labs — Slippage Settings](https://support.uniswap.org/hc/en-us/articles/8643879653261-How-to-change-slippage-on-the-Uniswap-Web-app)
- [Uniswap — Fees](https://developers.uniswap.org/docs/get-started/concepts/fees)
- [Ethereum.org — Gas and Fees](https://ethereum.org/developers/docs/gas/)
- [ERC-20 — Token Standard](https://eips.ethereum.org/EIPS/eip-20)
- [ERC-2612 — Signed Token Approvals](https://eips.ethereum.org/EIPS/eip-2612)
- [Uniswap Labs — Permit2 Approvals](https://support.uniswap.org/hc/en-us/articles/39683402190733-What-is-a-Permit2-approval)
- [Uniswap Labs — Transaction Failures](https://support.uniswap.org/hc/en-us/articles/8643975058829-Why-did-my-transaction-fail)
- [Uniswap Labs — Token Warnings](https://support.uniswap.org/hc/en-us/articles/8723118437133-What-are-token-warnings)
- [Ethereum.org — Maximal Extractable Value](https://ethereum.org/developers/docs/mev/)
- [Ethereum.org — Smart Contract Security](https://ethereum.org/developers/docs/smart-contracts/security/)
- [Ethereum.org — Blockchain Bridges](https://ethereum.org/bridges/)
- [Uniswap — Liquidity Overview](https://developers.uniswap.org/docs/liquidity/overview)
- [Terenval — Official Wallet Features](https://terenval.com/)

Official article: https://wallet.terenval.com/answers/what-is-a-decentralized-exchange-and-how-does-it-work/

[Machine-oriented Terenval index](https://wallet.terenval.com/llms.txt)
