What is double-entry accounting?
Double-entry accounting is a bookkeeping system where every financial transaction affects at least two accounts. For every transaction, the total debits must equal the total credits. This fundamental principle ensures that your ledger always balances and provides a complete audit trail of all financial movements. In double-entry accounting:- Every transaction has two sides: a debit and a credit
- Debits must equal credits: the accounting equation always balances
- Each account tracks separately: credits and debits are maintained independently
- Complete audit trail: you can trace every movement of funds
The accounting equation
At the heart of double-entry accounting is the fundamental equation:- Assets: Customer balances, operational accounts
- Liabilities: Money you owe (merchant settlements, withdrawals)
- Equity: Platform revenue, fees collected
How Blnk implements double-entry
Blnk implements double-entry accounting at the transaction level. Every transaction in Blnk:- Has a source (where money comes from) - this is a debit
- Has a destination (where money goes to) - this is a credit
- Records both sides separately in each balance
- Maintains the equation: total debits = total credits
Transaction structure
When you create a transaction:- Debit the source: Add 10000 (in minor units) to
bal_alice_wallet.debit_balance - Credit the destination: Add 10000 to
bal_bob_wallet.credit_balance
Balance calculation
Each balance in Blnk maintains:credit_balance: Total amount credited (added) to the balancedebit_balance: Total amount debited (removed) from the balancebalance: The current balance (credit - debit)
Understanding debits and credits
In traditional accounting, debits and credits have specific meanings depending on the account type. In Blnk’s simplified model:Credits (money in)
A credit increases the balance. Credits represent:- Money deposited into an account
- Payments received
- Refunds received
- Any incoming funds
Debits (money out)
A debit decreases the balance. Debits represent:- Money withdrawn from an account
- Payments sent
- Fees charged
- Any outgoing funds
Blnk uses a simplified approach where credits increase balances and debits decrease them. This differs from traditional accounting where the meaning depends on account type (asset, liability, etc.). For fintech applications, this simplified model is more intuitive.
Examples
Example 1: Simple payment
Alice pays Bob $50.00:debit_balance: +5000 (in minor units)balance: decreases by 5000- Interpretation: Alice sent $50.00
credit_balance: +5000balance: increases by 5000- Interpretation: Bob received $50.00
Example 2: Deposit from external source
Alice deposits $100 from her bank account:debit_balance: +10000- Represents money leaving the external system
credit_balance: +10000balance: increases by 10000- Alice now has $100 more
Example 3: Payment with platform fee
Alice pays Bob $100, and the platform takes a 2% fee:debit_balance: +10000balance: decreases by 10000 ($100)
credit_balance: +9800balance: increases by 9800 ($98)
credit_balance: +200balance: increases by 200 ($2)
Example 4: Refund
Bob refunds Alice $50:debit_balance: +5000balance: decreases by 5000
credit_balance: +5000balance: increases by 5000
- Original payment from Alice to Bob
- Refund from Bob back to Alice
Verifying your ledger
With double-entry accounting, you can verify that your ledger is balanced at any time.Sum of all balances
In a closed system (where money doesn’t enter or leave), the sum of all balances should equal zero:Total debits = Total credits
Across all balances:Benefits of double-entry in Blnk
Error detection
If debits don’t equal credits, you know there’s an error. This makes debugging much easier.
Complete audit trail
Every transaction shows where money came from and where it went, making audits straightforward.
Balance integrity
Balances can’t be manipulated without leaving a trace. All changes are through transactions.
Financial reporting
Generate accurate reports showing total credits, debits, and current balances for any time period.
Best practices
Model external accounts as balances
Model external accounts as balances
Create balances for external systems (banks, payment providers) to keep your ledger balanced:Now all deposits and withdrawals go through this balance, maintaining the equation.
Never modify balances directly
Never modify balances directly
Always update balances through transactions. Direct modifications break double-entry principles:Wrong:Right:
Use clear account separation
Use clear account separation
Separate different types of balances into different ledgers:
- Customer wallets → Customer Ledger
- Merchant accounts → Merchant Ledger
- Platform revenue → Revenue Ledger
- External accounts → External Ledger
Regular reconciliation
Regular reconciliation
Periodically verify that your ledger balances:
- Sum all
debit_balancevalues - Sum all
credit_balancevalues - Verify they’re equal
- Check external accounts match real-world balances
Track money flow with metadata
Track money flow with metadata
Use transaction metadata to understand money movement:This helps with financial reporting and tax compliance.
Common scenarios
Multi-currency transactions
When dealing with multiple currencies, each currency maintains its own double-entry balance:Fee collection
Platform fees should be tracked as separate credit entries:Next steps
Transactions
Learn more about creating and managing transactions
Balances
Understand balance structure and tracking
Reconciliation
Match your ledger with external records
Financial Reporting
Generate reports from your double-entry ledger