Most wallet prototypes start with a balance column and UPDATE wallets SET balance = balance - 30 . It works in the demo, and then three things happen in production: two requests spend the same money at the same time, a retry sends a transfer twice, and finance asks why the bank statement disagrees with the database. Nobody can answer, because the old balances were overwritten.
A double entry ledger fixes all three by changing what you store. You stop storing balances and start storing movements: every transfer becomes a journal entry with two or more postings that sum to zero. Balances become a query. History becomes append-only. Bugs become visible as a non-zero sum.
Here is the problem in one line of real output.…