Crypto Exchange Architecture: How the Parts Fit Together
A crypto exchange is a matching engine, wallets, a risk engine and data feeds working as one system. Here is how each part fits and where the trade-offs sit.
On this page
Short answer
Crypto exchange architecture is the design of the components that take orders, match them, hold coins, check risk and keep records, and the rules for how they connect. The core parts are the matching engine, the order book, hot and cold wallets, the risk engine, market data and settlement, each built so a failure in one cannot silently corrupt the others.
What is crypto exchange architecture?
Crypto exchange architecture is the design of the software that takes orders, matches them, moves coins, and keeps records. It is the set of components — matching engine, order book, wallets, risk engine, market data, and settlement — and the rules for how they talk to each other.
The design matters because an exchange is a money system under load. Orders arrive in bursts, prices move in milliseconds, and a bug in one component can freeze trading or lose funds. A clear architecture separates concerns so each part can be tested, scaled, and fixed on its own.
| Component | Main job | What breaks if it fails |
|---|---|---|
| Matching engine | Pairs buy and sell orders | Trading stops |
| Order book | Holds open orders by price | Wrong prices shown |
| Wallets | Hold and move coins | Funds stuck or lost |
| Risk engine | Checks limits before trades | Bad trades get through |
| Market data | Publishes prices and trades | Traders act on stale data |
| Settlement | Records who owns what | Balances disagree |
Most exchanges use the same building blocks and differ in how they connect them. The sections below walk through each part and the trade-offs that shape it.
How does the matching engine work?
The matching engine pairs buy orders with sell orders. When a buy order arrives at a price that meets a sell order, the engine records a trade at that price and updates both orders.
Most engines use price-time priority: the best price trades first, and among orders at the same price the earliest one trades first. This rule is simple to explain and hard to argue with, which is why traders accept it.
Speed matters, but correctness matters more. An engine that matches in the wrong order creates disputes that no amount of speed can fix. Teams test the engine against a log of real orders, replaying them to check that every trade follows the rule.
A single engine can handle a surprising amount of volume. When it cannot keep up, teams split markets across engines — one per trading pair — rather than splitting one pair across engines, because a split order book would break price-time priority.
How are wallets and custody arranged?
Wallets hold the coins, and their design decides how much is at risk at any moment. The common pattern is a small hot wallet for day-to-day withdrawals and a larger cold wallet kept offline.
Deposits go to addresses the exchange controls, then sweep into cold storage on a schedule. Withdrawals draw from the hot wallet, which is refilled from cold storage when it runs low. This keeps most funds out of reach of an online attack.
Signing is the sensitive step. A withdrawal needs a signed transaction, and the keys that sign should never sit on a server that faces the internet. Many teams use hardware signing devices or multi-party signing, so no single person or machine can move funds alone. The basics of holding coins for others are covered in what crypto custody is.
What does the risk engine check?
The risk engine checks every order before it reaches the matching engine. It confirms the account has enough balance, the order size is within limits, and the account is not barred from trading.
For margin trading, it also checks that the account has enough collateral for the borrowed funds, and it watches prices so positions can be closed before losses exceed the collateral. This is the part that protects the exchange from accounts that cannot pay.
The risk engine must be fast and strict. A check that is slow delays every order; a check that is loose lets bad trades through. Teams keep the checks simple and deterministic, so the same order always gets the same answer. The wider infrastructure around spot trading, including the risk engine, is covered in what crypto exchanges need beyond spot trading.
How does data flow through an exchange?
Every trade follows the same path through the system, and each step leaves a record. That record is what makes disputes solvable and audits possible.
- An order arrives and is checked by the risk engine.
- The matching engine pairs it and records the trade.
- The ledger updates both accounts' balances.
- Market data publishes the trade.
- Settlement moves coins or updates custody records.
The ledger is the source of truth for balances. If the ledger and the wallets disagree, trading should stop until the difference is found. Teams reconcile the two on a schedule, not only when something looks wrong.
Market data is a separate stream from the trading path. It feeds price charts, public feeds, and the risk engine's price checks, so it must be fast and consistent with the trades that actually happened.
Example: a small exchange plans its first year
Example (hypothetical): a team launches a spot exchange with 20 trading pairs. It expects 50,000 orders a day, with an average trade size of $200 and a fee of 0.1% per trade.
Fee income works out as 50,000 orders times $200 times 0.1%, which is $10,000 a day. That figure pays for servers, staff, and compliance, so the team sizes its budget from it rather than from hope.
The team also plans for a busy day at five times the average: 250,000 orders. Its matching engine handles 500 orders a second on one thread, which is 30,000 a minute — enough for the busy day with room to spare — so it spends its effort on wallet safety and reconciliation instead. The parts that make up the product are described in crypto exchange software.
What are the common mistakes?
The most common architecture mistakes in crypto exchanges are mixing money movement with trading logic, skipping reconciliation, and trusting a price feed that lags the order book.
- Mixing wallets and matching. Building the matching engine and the wallet logic in one service, so a trading bug can touch funds.
- Skipping reconciliation. Waiting for a balance gap to appear instead of checking ledger against wallets on a schedule.
- Trusting a slow price feed. Letting the risk engine read prices from a feed that lags the order book.
- Keys on trading servers. Storing signing keys on the same server as the trading API.
- Market data as an afterthought. Treating market data as a display feature instead of a system both traders and risk checks depend on.
Key takeaways
- An exchange is six parts: matching engine, order book, wallets, risk engine, market data and settlement
- The matching engine uses price-time priority, and correctness matters more than speed
- Most funds sit in cold storage; the hot wallet holds only what the day's withdrawals need
- The risk engine checks balance, limits and collateral before every order reaches the matching engine
- The ledger is the source of truth for balances and must be reconciled against wallets on a schedule
Frequently asked questions
What is the most important part of a crypto exchange?
The matching engine is the core, because every trade passes through it and its rules decide who trades first. But wallets and the risk engine matter just as much in practice: a fast engine with weak key storage or loose risk checks is a fast way to lose money.
How fast does a matching engine need to be?
Fast enough that traders never notice a delay, which for a small exchange is often a few hundred orders a second per market. Correctness comes first: an engine that matches in the wrong order creates disputes no amount of speed can fix.
Why do exchanges keep most funds in cold storage?
Cold storage keeps keys offline, so an attacker who reaches an online server cannot move most of the funds. The hot wallet holds only what the day's withdrawals need and is refilled from cold storage on a schedule.
What is the difference between the order book and the matching engine?
The order book is the list of open buy and sell orders by price. The matching engine is the software that reads that list, pairs orders that meet, and records the trades. The book holds state; the engine does the work.
Do decentralised exchanges use the same architecture?
They share the ideas — an order book or a pricing pool, custody, and risk checks — but the parts run on a blockchain or in smart contracts instead of on company servers. The trade-offs differ: on-chain matching is transparent but slower, and custody stays with the user.
How do exchanges handle a sudden surge in orders?
They split markets across matching engines, one per trading pair, and scale the stateless parts such as market data and the API. The ledger and wallets are the hard parts to scale, so teams design them for the busy day, not the average one.