Digital Wallet — Notes
Functional
- Top-up, withdraw.
- Send to friend, request money.
- Pay merchants.
- Bill pay, recurring subscriptions.
- Multi-currency.
Non-functional
- Strict consistency on balance.
- p99 transfer < 1 s for in-network; minutes for external rails.
- 99.99% uptime.
Capacity
- Big platforms: 100M+ active wallets, billions of txns/yr.
- Peak: tens of thousands of txns/s.
Schema
accounts(id, user_id, currency, status)
journal_entries(id, account_id, debit, credit, ref, ts) immutable
transfers(id, from_acc, to_acc, amount, status, idem_key, version)
link_methods(id, user_id, type, last4, ext_ref)
Trade-offs
- Ledger as source of truth, balances are projections.
- External rails are slow + flaky: pending state mandatory.
- PCI / banking compliance: tokenize cards, isolate scope.
- Strong consistency in-DC, eventual across-region for projections.
Refs
- "Building Square's Money Movement Platform" talks.
- PayPal architecture posts; Paytm engineering.
- "Distributed Transactions Done Right" (Stripe blog).
- ByteByteGo "Design a wallet".