← Back to context

Comment by hgomersall

1 year ago

Maybe I'm being naive, but this seems to be not too difficult... You have a general ledger in which the invariant that it always balances is properly enforced. The hard bit is scaling and performance. There are policies around fractional transactions, but you should never get mismatched entries.

I think the trick is to store the movement not the balances. You may cache the balance, but what matters is the journal of money moving from one account to another.

  • Exactly. Any proper ledger is a transaction log. Balances and turnovers are calculated, not stored. I've seen a lot of attempts to 'cache balances', and this was always the point where anything could go wrong.