This guide covers best practices for designing your chart of accounts in Formance Ledger, with a focus on handling real-world financial scenarios like debts, credit lines, and liabilities.Documentation Index
Fetch the complete documentation index at: https://docs.formance.com/llms.txt
Use this file to discover all available pages before exploring further.
Allowing Negative Balances
In Formance, accounts can be configured to carry negative balances, enabling accurate modeling of real-world financial obligations such as debts, credit lines, pending payments, or unsettled invoices.Why allow negative balances?
Allowing an account to go negative is a common way to represent liabilities or temporary obligations. For example:- A user owes funds to a platform or another user
- A credit line that can be drawn upon
- Pending settlements awaiting clearing
- Unsettled invoices
Enabling overdraft
To allow an account to have a negative balance, use theallowing overdraft clause in Numscript:
Debt Settlement Example
When a user pays off a debt, the transaction simply reduces the negative balance on the debtor’s account. This brings the balance closer to zero (or above), effectively recording the settlement of the liability.Scenario
- Alice owes 100)
- Alice pays $50 to Bob
- Alice’s balance becomes -$50
Best Practices for Account Naming
Avoid world as a generic source
To ensure clarity and traceability in your ledger:
Why this matters
- Audit trail: Specific addresses maintain a transparent record of where funds originated
- Context: Stakeholders can understand the purpose of each transaction
- Debugging: Easier to trace issues when accounts have meaningful names
Good vs. bad examples
| Bad | Good |
|---|---|
@world → @users:alice | @users:alice:payment:order-123 → @platform:revenue |
| Generic source | Specific, contextual source |
When to use world
The world account is appropriate for:
- Initial system bootstrapping
- Minting new assets (e.g., loyalty points, tokens)
- Non-funded currency conversions (see Currency Conversion)
Structuring Account Hierarchies
Use colons (:) to create meaningful account hierarchies:
Benefits of hierarchical naming
- Filtering: Query all accounts matching a pattern (e.g.,
users:123:) - Organization: Logical grouping of related accounts
- Scalability: Easy to add new account types without restructuring
Modeling Common Financial Scenarios
E-commerce Platform
Lending Platform
Multi-currency Wallet
Summary
| Concept | Recommendation |
|---|---|
| Negative balances | Use allowing overdraft for liabilities and debts |
| Account naming | Use specific, contextual addresses instead of world |
| Hierarchy | Use colons to create logical groupings |
| Debt settlement | Reduce negative balances through standard transactions |
For more information on the source-destination model and how it differs from traditional double-entry accounting, see Source-Destination Accounting Model.