HLD-413·Payments & Ledger
Expert · 2,000 ptsHigh-Frequency Crypto Margin Engine & Hot-Wallet Settlement
Design Coinbase / Binance’s 24/7 perpetuals margin collateral engine and withdrawal hot-wallet ledger preventing race-condition double-withdrawals during flash crashes.
Max p99
≤ 95 ms
Availability
≥ 99.5%
Budget
≤ $11,700
Functional Requirements
- FR-1POST /margin/{account_id}/withdraw — Atomically verifies free margin collateral, locks nonce, and debits ledger.
- FR-2GET /margin/{account_id}/equity — Returns real-time mark-to-market collateral and liquidation buffer.
- FR-3POST /margin/{account_id}/withdraw/reverse — Supports idempotent reversal/refund or campaign pause updates while keeping cached balances and deduplication keys consistent.
- FR-4Zero negative-equity race withdrawals and RPO = 0 across primary ledger node crashes.
Workload Profile
24/7 Baseline Trading64,000 Equity Read RPS / 12,500 Margin/Ledger Write RPS
20% Flash-Crash Liquidation Cascade170,000 Read RPS / 38,000 Concurrent Write RPS
Active Working Set38 GB margin positions, nonces & hot-wallet UTXO locks
Consistency GateStrict serializable collateral check + RPO = 0 quorum ledger
Consistency Model
Strict serializable per-account margin lock + idempotent withdrawal nonce + synchronous/quorum durability.
Relevant practice for
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.
Click an item in Inventory above, or press B to add a component, double-click to name, C to connect.
Design Write-up
Write under ### Architecture for Diagram to take that up directly
Compulsory section · if not written yet, Diagram reads from the start of your write-up.
Architecture: required·FRs mentioned: 0/4·0 boxes · 0 edges
0 words