Design a Bank Transfer System
HardSystem design · Payments
Design a system that moves money between bank accounts, both between accounts held at the same bank and to accounts at other institutions over external payment rails (instant and batch).
In scope: the transfer lifecycle as a state machine, double-entry ledger postings, idempotency, screening and compliance holds, handling of rail failures and returns, and reconciliation. Out of scope: card payments and the internals of any specific payment network.
Requirements
- Track transfer state transitions explicitly with conditional updates and crash recovery
- Use idempotency keys and an immutable double-entry ledger; never delete, only reverse
- Hold funds in suspense for external transfers and distinguish submitted, settled and returned
- Screen for sanctions and fraud before releasing funds, and reconcile against each rail's statement