Double-Entry Ledger
Also known as:
Double-Entry Bookkeeping
Double-Entry Accounting
Financial Ledger
Definition
A double-entry ledger records every money movement as two matching entries: a debit on one account and a credit on another, for the same amount. The books are correct only when total debits equal total credits, which turns accounting into an invariant a computer can check. Payment systems store the ledger as an append-only table, never updating balances in place, so every transaction has a permanent, auditable trail.
Popular reads
View All
Cursor Skills: How to Create and Use Agent Skills
Jun 23, 2026
X Algorithm Explained: How the Open Source Recommendation System Works
Jan 22, 2026
Payment System Design: Ledger, Idempotency, and Settlement
Jul 18, 2026
The Complete HTMX Guide: From Zero to Production
Dec 22, 2025
Local LLM Speed: RTX 3060, Qwen2 & Llama Benchmark Results
Jan 15, 2026
Transactional Outbox Pattern: Never Lose an Event Again
Apr 07, 2026
Key Takeaways
- Every entry has two sides. A debit to one account is always matched by an equal credit to another, so the ledger always balances.
- The ledger is append-only. You never edit or delete a row; a correction is a new pair of entries, which keeps a full audit trail.
- Balances are derived by summing entries, not stored and mutated, which removes a whole class of race conditions and drift.
- The balance invariant (debits equal credits) is a cheap, constant check that catches bugs, partial writes, and fraud early.
How It Works
- Each financial event (charge, refund, payout, fee) is written as two or more rows that sum to zero across accounts.
- Rows are inserted inside one database transaction so a partial write can never leave the books unbalanced.
- An account balance is computed by summing its debit and credit rows, often cached in a rollup table for speed.
- Corrections are made by appending reversing entries, never by editing history, so the ledger stays immutable.
Where It Is Used
- Stripe, PayPal, and Square all model money movement on an immutable double-entry ledger.
- TigerBeetle is a database built specifically for high-throughput double-entry accounting.
- Banks have used double-entry bookkeeping for centuries; payment platforms encode the same idea in software.