HLD-404·Payments & Ledger
Expert · 2,000 ptsIdempotent Payment Ledger & Double-Entry Wallet
Design a mission-critical double-entry wallet and payment transfer engine surviving payday settlement bursts, client retry storms, and primary database node crashes with zero double-spends.
Max p99
≤ 130 ms
Availability
≥ 99.5%
Budget
≤ $8,200
Functional Requirements
- FR-1POST /v1/transfers — Atomically debits sender wallet_id and credits recipient with idempotency_key deduplication.
- FR-2GET /v1/wallets/{wallet_id}/balance — Returns authoritative available balance and recent ledger entries.
- FR-3POST /v1/transfers/{wallet_id}/reverse — Supports idempotent reversal/refund or campaign pause updates while keeping cached balances and deduplication keys consistent.
- FR-4Zero committed transfers may be lost (RPO = 0) and negative-balance race conditions must be impossible.
Workload Profile
Baseline Volume35,000 Balance Read RPS / 9,000 Transfer Write RPS
Payday Peak90,000 Read RPS / 34,000 Concurrent Transfer Write RPS
Active Working Set40 GB hot merchant & consumer wallet state
Availability TargetFinancial tier >= 99.5% availability across node crash
Consistency Model
Strict serializable balance mutation + RPO = 0 synchronous/quorum replication; zero double-debit or stale balance overdrafts.
Solutions Locked
Sign in and either achieve AC or complete 3 official submissions on this question to inspect community diagrams and writeups.
Loading solutions...
Submission History (0)Select to replay
No submissions yet
Click Submit in the top bar to evaluate against all 7 judge cases and save each run here.
Design Write-up
0 boxes · 0 edges
0 words