Preview. Stack v4.0 has not been released, and what is documented here can still change before it does. The current release is v3.2.Go to v3.2
Cookbook

Account Hierarchy Examples

Example Ledger account hierarchies and design choices for common financial use cases.

These examples show how to structure account hierarchies for common fintech use cases. For the principles behind the naming and structure choices, see Chart of Accounts.

E-commerce platform#

walletaccount
type=customer_wallet
earningsaccount
settlementsaccount
pendingaccount
capturedaccount
feesaccount
vataccount
poolaccount

Key design decisions in this hierarchy:

  • Customers have wallet accounts with a wallet sub-account, keeping balance state isolated per user.
  • Merchants separate earnings (accrued revenue) from settlements (disbursed funds), making payout reconciliation straightforward.
  • Orders have lifecycle accounts (pending, captured) so each order's state is traceable without relying on metadata.
  • Platform centralizes fees, VAT, and refund pools as named accounts, giving finance a clean query surface for revenue reporting.

Lending platform#

principalaccount
type=borrower_principal
interestaccount
availableaccount
deployedaccount
outstandingaccount
paymentsaccount

Key design decisions in this hierarchy:

  • Borrowers and lenders are separated into their own hierarchies, keeping lender capital distinct from borrower liabilities.
  • Loan accounts (outstanding, payments) track state at the individual loan level; each loan's outstanding balance and payment history are isolated, making arrears management and early repayment calculation straightforward.

Multi-currency wallet#

USDaccount
EURaccount
BTCaccount
USDaccount
EURaccount
feesaccount

Key design decisions in this hierarchy:

  • Per-user, per-currency wallet accounts (users:{id}:wallet:USD, users:{id}:wallet:EUR) allow clean balance isolation; an account's USD balance and EUR balance never interfere.
  • Exchange liquidity pools hold pre-funded reserves for funded conversions. Debiting from exchange:liquidity:USD and crediting users:{id}:wallet:USD keeps BTC or EUR creation strictly bounded by what was pre-funded.
  • Exchange fees are collected in a single platform account, making fee revenue reporting a simple balance query.