Design a Cryptocurrency Exchange
HardSystem design · Trading · Coinbase
Design a centralized spot cryptocurrency exchange. Users place and cancel limit and market orders, a matching engine executes trades, balances stay correct, and clients receive order book and trade updates in real time.
In scope: order entry, sequencing and matching, balance holds and settlement, market data fanout, failover and replay, and audit. Out of scope: the blockchain deposit and withdrawal machinery (see the crypto wallet problem), margin, and derivatives.
Requirements
- Separate order entry, a single-writer deterministic matching engine, the ledger, and market data publication
- Reserve balances before orders enter the book; release holds only on engine events
- Total order via a replicated journal; same input must always produce the same output, enabling replay
- Survive matcher failure without losing or repeating orders; publish sequenced market data with snapshot plus delta recovery