Crypto money exchanges are platforms or protocols that facilitate the conversion of one asset into another, whether fiat to crypto, crypto to fiat, or crypto to crypto. They operate as centralized custodians, noncustodial aggregators, or fully onchain automated market makers. The technical differences between these models determine custody risk, execution price, settlement finality, and regulatory exposure. This article covers the core execution architectures, how order routing and liquidity sourcing work under the hood, and the failure modes practitioners encounter when moving capital across these systems.
Centralized Exchange Architecture
Centralized exchanges run an offchain order book and matching engine. When you deposit funds, the exchange credits an internal database entry. Trades execute against other users’ database balances. Onchain settlement occurs only during deposits and withdrawals.
The matching engine pairs bid and ask orders by price and timestamp. Most engines use a price-time priority algorithm: the best priced order at the earliest timestamp gets filled first. High frequency market makers submit and cancel thousands of orders per second to capture spread. The exchange charges a taker fee for orders that remove liquidity and a maker fee (often lower or rebated) for orders that add liquidity to the book.
Custody risk sits with the exchange. Your balance is a liability on the exchange’s ledger, backed by a mix of hot wallets for operational liquidity and cold storage for the majority of user funds. If the exchange becomes insolvent or halts withdrawals, you hold an unsecured claim, not direct control of keys. Some exchanges publish Merkle tree proofs of reserves, allowing users to verify that their balance appears in a snapshot, but this does not prove the exchange controls matching liabilities or that reserves remain unencumbered.
Noncustodial Aggregators and Smart Order Routing
Noncustodial aggregators route trades across multiple liquidity sources without taking custody. The user signs a transaction or message that delegates execution to the aggregator’s smart contracts or relayers. The aggregator queries rates from decentralized exchanges, automated market makers, and sometimes centralized exchange APIs, then splits the order across venues to minimize slippage and gas costs.
Smart order routing involves calculating the effective price for each liquidity source after fees and price impact, then determining the optimal split. For example, a 10,000 USDC to ETH swap might route 6,000 USDC through Uniswap V3 and 4,000 USDC through Curve if the blended rate beats either single venue. The aggregator submits a multicall transaction that executes each leg atomically. If any leg fails, the entire transaction reverts.
Gas cost becomes a binding constraint on small trades. A complex route across four pools might cost 400,000 gas. At 50 gwei and ETH priced at $2,000, that’s roughly $40. For a $500 swap, gas consumes 8% of notional. Aggregators often limit routing complexity below certain trade sizes to avoid negative net execution.
Onchain Automated Market Makers
Automated market makers use liquidity pools instead of order books. Liquidity providers deposit token pairs into a pool, and the AMM applies a pricing curve to quote trades. The constant product formula x times y equals k is the simplest model, where x and y represent the pool reserves of two tokens. Swapping token A for token B reduces the reserve of B and increases the reserve of A, moving the price along the curve.
Price impact scales nonlinearly with trade size relative to pool depth. A 1% swap (1% of pool reserves) on a constant product AMM produces roughly 0.5% slippage. A 10% swap produces approximately 5% slippage. Arbitrageurs monitor price divergence between the AMM and external markets. When an AMM price drifts from the oracle or centralized exchange price, arbitrageurs trade to capture the difference, pushing the pool price back toward equilibrium. Liquidity providers earn fees from this flow but incur impermanent loss when the external price moves away from the ratio at which they deposited.
Concentrated liquidity models like Uniswap V3 allow liquidity providers to allocate capital within a price range. This increases capital efficiency but also increases the risk that price moves outside the range, leaving the position inactive. Active management is often required to rebalance positions as price evolves.
Settlement Finality and Reorg Risk
Centralized exchanges offer immediate internal finality. Once a trade executes in the matching engine, the balance update is final from the user’s perspective, though the exchange retains the ability to reverse transactions in cases of detected fraud or technical error.
Onchain settlements depend on block finality. On proof of work chains, finality is probabilistic. A transaction with six confirmations is widely considered irreversible, though deeper reorgs remain theoretically possible. On proof of stake chains with finality gadgets like Ethereum’s Casper FFG, finality is economic. Once an epoch is finalized, reversing it requires slashing at least one third of staked validators, a cost measured in billions of dollars.
Crosschain exchanges introduce additional finality risk. Atomic swaps using hash timelocked contracts allow trustless exchange across chains, but require both parties to remain online and both chains to finalize within the timelock window. Bridge based exchanges lock assets on the source chain and mint wrapped tokens on the destination chain. The bridge’s security model (multisig, optimistic verification, or light client proof) determines whether a reorg or validator collusion on one chain can result in double spending or locked funds.
Order Types and Execution Guarantees
Centralized exchanges support limit orders, market orders, stop losses, and algorithmic order types like iceberg and time weighted average price orders. Limit orders guarantee price but not execution. Market orders guarantee execution but not price, filling against the current book up to the order size.
Onchain exchanges typically support only immediate execution with slippage bounds. The user specifies a minimum output amount. If the quoted output falls below this threshold due to price movement or frontrunning, the transaction reverts. Protocols like CoW Protocol batch orders and allow solvers to find coincidence of wants, executing opposing trades within the batch against each other before accessing onchain liquidity. This reduces both gas costs and sandwich attack surface.
Worked Example: Routing a 50 ETH to USDC Swap
You want to convert 50 ETH to USDC. A centralized exchange shows a mid market price of 2,000 USDC per ETH, 0.1% taker fee, and sufficient depth within 0.05% of mid for your size. Expected proceeds: 50 times 2,000 times 0.999 equals 99,950 USDC.
An aggregator queries Uniswap V3, Curve, and Balancer. Uniswap V3 quotes 98,500 USDC after 0.3% fee and 1.2% price impact. Curve quotes 30,000 USDC for 15 ETH with 0.04% fee and 0.3% impact. Balancer quotes 20,000 USDC for 10 ETH with 0.5% fee and 0.8% impact. The aggregator routes 15 ETH to Curve, 10 ETH to Balancer, and 25 ETH to Uniswap, yielding a blended 99,200 USDC. Gas cost is 0.02 ETH (roughly 40 USDC). Net proceeds: 99,160 USDC.
The centralized exchange delivers better execution for this size, but you incur custody risk during the deposit, trade, and withdrawal cycle. The aggregator provides atomic settlement and no custody risk, but the net rate is slightly worse. Your choice depends on whether the 790 USDC (0.8%) difference justifies the operational and counterparty risk of using a centralized venue.
Common Mistakes and Misconfigurations
- Approving unlimited token spend to aggregator contracts without understanding the contract’s upgradeability or governance. If the contract is upgraded maliciously or a bug is exploited, approved tokens become vulnerable.
- Setting slippage tolerance above 1% on large trades in shallow pools. Frontrunning bots monitor the mempool and sandwich user transactions, extracting value equal to the slippage buffer.
- Assuming centralized exchange API rates match executable rates during volatile periods. The API often reflects stale book snapshots, and the actual fill price may be significantly worse.
- Using market orders on thin order books. A large market sell can cascade through multiple price levels, resulting in execution 5% or more below the quoted top of book.
- Ignoring deposit and withdrawal confirmation requirements on centralized exchanges. Some exchanges require 30 or more confirmations for certain assets, delaying access to funds by hours.
- Failing to account for gas price volatility when executing multicall routes onchain. A sudden gas spike can turn a profitable route into a net loss after transaction fees.
What to Verify Before You Rely on This
- Current fee schedule for the exchange or protocol you are using. Maker, taker, and withdrawal fees change based on volume tiers and protocol governance votes.
- The exchange’s proof of reserves methodology and latest attestation date if you are evaluating custody risk.
- Liquidity depth at your trade size. Use the exchange’s API or onchain pool queries to simulate price impact before execution.
- Settlement time and confirmation requirements for deposits and withdrawals on both centralized and decentralized platforms.
- Gas cost estimates for onchain routes. Query recent similar transactions to estimate typical gas usage and multiply by current gas price.
- Whether the aggregator contract you are using is upgradeable and who controls the upgrade key or governance process.
- The token approval status for any router or contract you plan to interact with. Use a tool to audit approvals and revoke unnecessary permissions.
- Regulatory status of the exchange in your jurisdiction. Some exchanges restrict users by IP or KYC jurisdiction, and using a VPN may violate terms of service and result in frozen funds.
- Whether the exchange or protocol has insurance or user protection mechanisms in case of loss, and the specific coverage limits or conditions.
- The bridge security model if you are moving funds crosschain. Understand whether the bridge uses a multisig, optimistic fraud proof, or zk proof, and what the trust assumptions are.
Next Steps
- Run a test trade at small size on your chosen exchange or aggregator to confirm execution flow, fees, and settlement time before committing larger capital.
- Set up monitoring for onchain liquidity and centralized exchange depth if you trade frequently. Use APIs or subgraphs to track pool reserves and order book snapshots.
- Review and minimize token approvals regularly. Revoke approvals for contracts you no longer use or that have uncertain security track records.
Category: Crypto Exchanges