A payments ledger you can trust

Balances live in one column that gets overwritten. Design a ledger that survives retries, failures and audits.

To design a payments ledger, record every transfer as balanced double-entry rows in an append-only table and derive balances from them. Make requests idempotent with client keys, commit each transfer in one transaction, and reconcile with the external bank using an explicit state machine for unknown outcomes.

The system today: A wallet app keeps each user's balance in a column on the users table. Sending money subtracts from one row and adds to another in the same request. When a request times out the app retries, and support cannot say why some balances are wrong.

What has to change: Design the money-movement system: transfers between wallets, top-ups and withdrawals through an external bank, at 5,000 transfers a second. It must never create or destroy money, must be safe when a client retries, must be auditable, and must keep working when parts of it fail.

Questions to ask first

Where the interviewer digs in

What a strong answer covers

Common mistakes