Phase 1 — Clarify & Scope
Interviewer: Design a digital wallet — think PayPal, Venmo, or WeChat Pay. What do you want to clarify?
Candidate: A few key questions:
- What operations does the wallet support — add money, send to another user, pay merchants, withdraw?
- Are balances real money or points/credits?
- What's the transaction volume and value?
- Multi-currency or single currency?
- Consistency model — can we tolerate brief balance inconsistency, or must every transfer be instantly consistent?
Interviewer: Peer-to-peer transfers (send to friend), merchant payments, add money from bank (ACH), withdraw to bank. Real money — USD only. 1 million users, 10 million transactions/day, average $25. Strong consistency — balance must always reflect completed transactions accurately. No overdrafts allowed.
Candidate: Let me size this:
This is real money — correctness is more important than performance. Even one incorrect balance update causes regulatory and trust issues.
Interviewer: What are the core requirements?
Candidate:
- Debit/credit wallet balance with ACID guarantees
- P2P transfer: atomic — sender debited iff receiver credited
- No negative balances (insufficient funds check)
- Idempotent operations — duplicate requests must not double-debit
- Complete audit trail of every balance change
- Reconciliation — total system balance must equal sum of all wallet balances
Non-functional:
- Transfer latency: < 500 ms p99
- Exactly-once transfer semantics
- Balance accuracy:…
In the full tutorial
- Phase 2 — High-Level Architecture
- Phase 3 — Deep Dive & Evolution
- Phase 4 — Robustness & Operations