4 ms·
> where you insist that every entry touches exactly two accounts A ledger is where every transaction balances to 0. It can involve multiple accounts, but the
by akira2501 2y ago
> where you insist that every entry touches exactly two accounts
A ledger is where every transaction balances to 0. It can involve multiple accounts, but the sum of all transfers between all accounts in a single transaction must sum to 0. This is the property of double entry that actually matters.
- hgomersall 2y agoMaybe 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.
- qznc 2y agoI 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.
- kdmtctl 2y agoExactly. 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.