Backend & systems·Data modelling and storage engines
you stop storing the current balance and instead store every deposit and withdrawal, deriving the balance by replaying them.
Event sourcing
Persisting state as an ordered log of immutable events, with current state as a derived projection. You get a complete audit trail and the ability to rebuild any view by replaying history. What you give up is ad-hoc querying, cheap schema change, and the ability to ever delete anything easily — events are forever, including the ones with a bug in them.