Design a Double-Entry Ledger for Customer Crypto Balances
Last updated: November 29, 2026
Quick Overview
Design the system of record for customer and company balances across hundreds of assets, supporting trades, deposits, withdrawals, fees and transfers with strict correctness and a full audit trail.
Coinbase
November 29, 20260
0
0 solved
Design the system of record for customer and company balances across hundreds of assets, supporting trades, deposits, withdrawals, fees and transfers with strict correctness and a full audit trail.
Coinbase holds customer assets and is audited and regulated, so the ledger is the most correctness-critical service it has. The interviewer wants double-entry invariants, idempotency, how balances are derived and read quickly, and how you prove the ledger matches the blockchain and bank accounts.
What the Interviewer Expects
- Immutable journal entries whose postings sum to zero per asset
- Idempotency keys on every money movement
- Account balance materialization with concurrency control
- Holds or pending states for in-flight withdrawals and orders
- Reconciliation against on-chain and bank data
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How do you reverse a posting that was wrong?
- How would you shard the ledger when one hot account (the fee account) gets every trade?
- How do you produce an as-of balance for a tax or audit date?
- How do you migrate the schema without downtime on a ledger?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
Functional: post transactions such as 'user A buys 0.1 BTC for 6,000 USD with a 30 USD fee'; read balances; list history; place and release holds. Non-functional: never create or destroy value, exactl...
High-Level Design
A ledger service owns a relational database (Postgres or a distributed SQL store). Tables: accounts (owner, asset, type), journal entries (id, idempotency key, type, created at), postings (entry id, a...