EconoFlux
BTC / USD $77,264.01 -0.92% 24h ETH / USD $2,260.13 -0.20% 24h SOL / USD $92.38 -2.34% 24h

Exchanges & platforms / 12 min read

Centralized vs Decentralized Exchanges: How They Work and How They Differ

A practical beginner’s guide comparing centralized exchanges (custodial order books) and decentralized exchanges (on-chain smart-contract swaps and AMMs), explaining deposits, trades, approvals, gas, routing, liquidity, fees, risks and safe operational steps.

Educational guide · Sources checked before publication

Original educational diagram: Centralized and decentralized exchanges: how they work and differ
Original EconoFlux educational illustration; conceptual diagram, not a photograph.

Overview: What 'exchange' means in crypto

Resumen en español: qué es un exchange

In cryptocurrency, an exchange is a place where you trade one asset for another. Two broad models dominate: centralized exchanges (CEXs) and decentralized exchanges (DEXs). A centralized exchange is a company that provides an interface to buy, sell and hold crypto while custodying the assets for you until you withdraw them. A decentralized exchange executes trades on a blockchain via smart contracts and usually does not take custody of your tokens.

This guide compares the mechanisms, user steps, fees, liquidity models and primary risks of each approach. Explanations use foundational descriptions from Ethereum.org and Coinbase Learn to ensure clear, sourced definitions and operational details.

  • CEX: a business that holds user balances and matches orders (custodial).
  • DEX: on-chain smart contracts that let wallets swap tokens without centralized custody.

Accounts and custody: who controls the keys

A core difference is custody. On Ethereum, there are externally owned accounts (EOAs) controlled by private keys and smart contract accounts controlled by code. Centralized exchanges typically create and manage custodial accounts for users: you log in with credentials, and the exchange records your balance in its database. Those deposited funds are under the exchange’s operational custody until you withdraw them to a wallet you control.

With a DEX you use your own wallet (an EOA). You keep private keys and sign transactions that interact with DEX smart contracts. You retain control of tokens until you sign a transaction that moves them into a contract or to another address. Ethereum.org explains the account model and Coinbase Learn notes that DEXs trade without you giving control of funds to a company.

Typical user steps: deposits, trading and withdrawals

Centralized exchange flow (typical): deposit → trade → withdraw.

1) Deposit: you send assets or fiat to the exchange’s deposit address or use an on-ramp to buy crypto. The exchange credits your account in its internal ledger. While funds are deposited, they are subject to the exchange’s custody and operational risks.

2) Trade: the exchange matches your order with other users’ orders (usually via an order book) or executes trades in its internal market. Settlement between users is handled off-chain inside the exchange’s ledger.

3) Withdraw: when you ask to withdraw, the exchange sends assets on-chain to your external address. Withdrawals are subject to exchange processing rules, minimums, and network fees.

DEX flow (typical): connect wallet → approve (when required) → swap → confirm on-chain.

1) Connect wallet: you connect a wallet to a DEX frontend; the wallet signs transactions and does not hand over private keys.

2) Approve: for ERC-20 token swaps, you often give a token allowance (an approval) to the DEX contract so it can transfer your tokens during a swap. Approvals are permissioned by your signature.

3) Swap: you submit a transaction that calls the DEX smart contract. The contract moves tokens and updates balances on-chain in the same transaction. Settlement is immediate on-chain once the transaction confirms.

4) No centralized withdrawal step is needed because you already control the wallet where funds reside.

How prices and trades are matched: order books versus AMMs

Centralized exchanges commonly use an order book model similar to traditional markets: buyers and sellers post orders (limit or market), and the exchange matches opposing orders off-chain to determine execution price. This off-chain matching lets CEXs offer features like limit orders, order types, and fast internal settlement.

Many DEXs use automated market makers (AMMs) rather than order books. An AMM is a smart contract that holds a liquidity pool of two or more tokens contributed by liquidity providers. Prices are set by a deterministic formula (for example, the constant product formula used by early AMMs). Traders swap against the pool; each trade changes the pool’s token ratios and thus the price.

Coinbase Learn explains that DEXs commonly compute prices algorithmically and that liquidity pools supply the funds for swaps. Because AMMs compute prices automatically, they don’t need a separate counterparty matched off-chain.

  • Order book: price discovery via matching of individual buy/sell orders off-chain (CEX).
  • AMM: algorithmic pricing using liquidity pools on-chain (DEX).

Token approvals and allowances: what they are and how to manage them

On Ethereum and similar token standards, contracts cannot move your tokens unless you give them permission. This permission is an allowance (approved amount) that you sign using your wallet. Typical DEX UIs create an approval transaction so the DEX contract can transfer your ERC-20 tokens during a swap.

Approvals are important because an unlimited allowance gives a contract the right to move your tokens later without a new on-chain approval. Ethereum.org’s security guidance warns that approvals are a common source of risk: if a contract is malicious or later compromised, an unlimited allowance could enable large, future drains.

A cautious approach is to approve only the exact amount you plan to swap or to use per-trade allowances when possible. That means more on-chain transactions (and more gas) but reduces exposure from future contract compromise. The trade-off is operational cost versus long-term exposure.

Gas, routing, slippage and fees: costs and why they matter

Gas: On Ethereum you need the native asset (ETH) to pay gas for any transaction, including DEX swaps. Gas is paid to miners/validators to include and execute transactions on-chain. Ethereum.org notes that native asset is required to pay network fees, separate from protocol fees.

Routing: DEX frontends or on-chain routers may split a swap across multiple pools to get a better price. Routing can reduce price impact but increases on-chain complexity and gas usage. The router still executes atomic on-chain swaps: either all legs succeed or the whole transaction reverts.

Slippage: slippage is the difference between the expected price and the executed price, often caused by market movement or the trade’s size relative to pool liquidity. DEX UIs let you set a maximum slippage tolerance; if actual execution exceeds it, the transaction reverts.

Fees: DEX protocols typically charge a protocol or pool fee (for example, earlier Uniswap pools commonly used a 0.3% fee that goes to liquidity providers). Separately, gas fees are paid to the network and can be a larger portion of the cost, especially for small trades. Centralized exchanges charge trading fees and may charge withdrawal fees; these are applied off-chain and on-chain respectively when withdrawing.

  • Network gas (paid in native asset) — mandatory for on-chain DEX operations.
  • Protocol/pool fees — paid to liquidity providers or protocol, separate from gas.
  • Exchange trading/withdrawal fees — typical on centralized platforms.

Liquidity, price impact and impermanent loss

Liquidity describes how much of a token is available to trade at a given price. On CEXs, order book depth determines how large a trade affects the market price. On AMM DEXs, the pool’s reserves determine price impact: larger trades change the ratio of tokens in the pool more, moving the effective price.

For liquidity providers (LPs) who supply funds to AMM pools, impermanent loss is the term used to describe how providing liquidity can produce a lower dollar value compared to simply holding the tokens when prices change. Ethereum.org’s DeFi material explains that AMM pools and liquidity provision are core DeFi primitives and include trade-offs like impermanent loss and reward fees.

Traders must consider that low-liquidity pools can show large slippage and price impact, while LPs must weigh fee income against potential impermanent loss.

Centralized frontends and governance: where centralization can reappear

A DEX’s smart contracts may be decentralized, but the user experience often depends on a separate frontend website or app. That frontend can be run by a team that has centralized control over hosting and presentation. If the frontend is down, misconfigured, or altered, it can affect discoverability and usability—even if the underlying contracts remain callable by wallets directly.

Additionally, some protocols use governance mechanisms (voting, upgrades) that may centralize control in certain phases. Ethereum.org explains that DeFi systems include a range of governance and upgrade patterns. Users should not assume every component of a named DEX is decentralized in every dimension.

Security risks: custody, smart contracts and operational exposures

CEX risks: when you deposit to a centralized exchange you transfer custody to the company. While reputable companies may hold assets in cold storage and use operational controls, deposited funds are exposed to exchange-level operational risk, including hacking, mismanagement or insolvency. Ethereum.org’s guide to obtaining ETH underlines that buying on an exchange implies custody until you withdraw.

DEX risks: DEXs reduce counterparty custody risk because you keep private keys, but they introduce smart contract risk. Smart contracts may contain bugs or design flaws that could be exploited, leading to loss even though you control keys. The DeFi materials on Ethereum.org note that code-level risks and economic attack vectors exist in open protocols.

Other risks: scams, rug pulls and malicious tokens are possible on DEXs because anyone can create tokens and add them to liquidity pools. Frontend phishing and incorrect contract interactions also pose threats; Ethereum.org’s security guidance stresses the irreversibility of transactions and the danger of approving unknown contracts.

  • CEX: custody risk, operational/human failure, withdrawal controls.
  • DEX: smart contract vulnerabilities, malicious tokens, frontend phishing.

Practical step-by-step safety practices

Use the right tool for the job: for fiat on-ramps and simple buying, a regulated centralized exchange often simplifies identity verification and fiat rails. For custody and on-chain composability, a wallet plus DEX may be preferable.

If using a CEX: only keep on-exchange the funds you plan to trade; withdraw long-term holdings to a wallet you control. Remember that deposited balances are held under the exchange’s custody.

If using a DEX: use a secure wallet, keep an appropriate ETH balance for gas, review token addresses carefully, set reasonable approval allowances, and consider using a hardware wallet for signing high-value transactions. Ethereum.org recommends hardware wallets because private keys remain offline during signing.

For both: verify contract addresses via official sources before approving, don't approve unlimited allowances for unknown contracts, and be aware that on-chain transactions are irreversible once confirmed. When in doubt, test with small amounts to confirm a process before committing larger funds.

  • Check exact token contract addresses (don’t rely solely on token name).
  • Use small test transactions for new flows.
  • Prefer hardware wallets for large-value operations.
  • Limit approvals where practical to reduce future exposure.

Comparison table: core mechanisms and trade-offs

The table below summarizes main technical differences without assigning security rankings. Mechanisms and limitations are compared based on how each model typically operates.

FeatureCentralized Exchange (CEX)Decentralized Exchange (DEX, AMM style)
CustodyExchange holds deposited assets in its internal ledger until withdrawal.User retains private keys; trade executed by smart contract after signing.
Price discovery / matchingOff-chain order book matching between users.Algorithmic pricing via liquidity pools (AMM) or on-chain order books.
SettlementOff-chain ledger updates; on-chain only at deposit/withdrawal.On-chain atomic settlement within transactions.
Need for native asset (gas)Network fees apply when withdrawing on-chain; trading internal often no gas.Every swap requires gas in native asset (e.g., ETH) to execute on-chain.
LiquidityProvided by centralized market makers and user orders; can be deep with large platforms.Provided by liquidity pools; fee income incentivizes LPs, but pool size affects slippage.
RisksCustody, operational security, withdrawal controls.Smart contract bugs, malicious tokens, frontend dependencies.
AccessOften supports fiat-to-crypto; subject to account controls and KYC.Crypto-to-crypto only (generally); open, permissionless but reliant on wallets.

Frequently Asked Questions

Q: Do I need to give a DEX custody of my tokens to trade? A: No. DEXs rely on your wallet signing transactions; you keep custody of tokens until you sign an on-chain transfer or approval. Coinbase Learn highlights that DEXs let you trade without handing control to a company.

Q: Why do I need ETH to use many DEXs? A: ETH (or the chain’s native asset) pays gas to execute transactions on-chain. Ethereum.org explains that the native asset is required to pay network fees for transactions.

Q: What is a token approval/allowance and should I set unlimited approval? A: An approval lets a smart contract transfer a specified amount of your ERC-20 token. Ethereum.org recommends caution: unlimited allowances increase exposure if the contract is later compromised, so consider limiting allowances to planned trade amounts.

Q: Can a DEX frontend be shut down or altered by a company? A: Yes. Frontends are often hosted and maintained by teams; they can be modified or become unavailable. The underlying contracts may still be callable directly if you know the addresses and can construct transactions with a wallet.

Q: Are on-chain DEX trades reversible? A: No; on-chain transactions are irreversible once included in a block. Ethereum.org’s security guidance emphasizes that mistakes and malicious approvals can lead to permanent loss unless the counterparty voluntarily returns funds.

Q: How do flash loans relate to AMM liquidity pools? A: Flash loans borrow on-chain liquidity and must be repaid within the same transaction or the whole transaction reverts. AMM pools are common sources of liquidity used in flash loan strategies; Ethereum.org’s DeFi material notes that flash loans are a composability feature of DeFi protocols.

Conclusion: choose based on needs and trade-offs

Centralized exchanges simplify fiat access and provide familiar order-book features, but they require trusting a company with custody. Decentralized exchanges offer noncustodial, composable on-chain trading—especially useful if you want to remain in control of private keys and interact with DeFi—but they require understanding gas, approvals, routing and smart contract risk.

Neither model is categorically superior in all dimensions. For small, routine fiat purchases a regulated exchange can be convenient. For on-chain composability, privacy patterns, or retaining custody, a DEX with a secure wallet and prudent approvals is appropriate. In all cases, follow practical safety steps: verify contracts, prefer hardware wallets for large amounts, limit approvals, and test unfamiliar flows with small amounts.

Sources & further reading

Sources and methodology · Report a correction

For information only. Not financial advice.

Read in Spanish →

Continue learning

Keep exploring