Question
Design a continuous self-consistency checker for a high-volume double-entry ledger that proves, on an ongoing basis, that the ledger's own invariants hold: every transaction's debits equal its credits, the sum of all balances across each currency is zero (or equals the expected float), and no balance violates its floor. ~30M postings/day. You need to catch a violation within minutes of it being introduced (a bug in a new code path), pinpoint the offending transaction, and do this without locking or scanning the entire ledger every time. How do you build it?
Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.