Double-Entry Ledger
Double-entry bookkeeping is a 500-year-old accounting method with one core rule: every credit must have a matching debit, and the sum of all entries must always equal zero.
This sounds like an accounting formality, but it’s actually a powerful consistency invariant. If balances always sum to zero, then:
- No value can appear from nowhere
- No value can silently vanish
- Every debit is traceable to a corresponding credit
- The entire history of a balance can be reconstructed from the journal
In Trancent
Each journal entry has one or more lines. Each line has a functionalAmount — the base-currency-equivalent value, which may be positive (debit) or negative (credit). The sum of all functionalAmount values must equal exactly zero.
// Valid: +10000 + -10000 = 0 ✓
lines: [
{ glAccountCode: "assets.token-pool", functionalAmount: 10000 },
{ glAccountCode: "revenue.token-sales", functionalAmount: -10000 },
]
// Rejected: +10000 + -9000 = +1000 ✗ (400 Bad Request) Note: transactionAmount is the amount in the line’s own currency (for multi-currency entries). Only functionalAmount (the base currency equivalent) is required to sum to zero.