Skip to main content

Bank8:Ledger - the core ledger

The system of record for money positions: accounts, products, double-entry postings, balances, schedules, and the full configuration library (parameters, flags, restrictions, calendars, plans, contracts) that drive them. 91 endpoints, 44 tables, one schema the service owns exclusively.

Use cases​

Retail & business banking​

  • Account opening - an open product factory: any financial product is creatable as data (free-form type + parameters + validation modules); products compose validation modules (limits, overdraft rules, sweeps, tiered rates) and parameters resolve through the hierarchy (global → product → account) so a product change never needs data migration. Read The product factory.
  • Transfers - a transfer is one POST /v1/postings call with a batch and a single instruction; retries with the same idempotency_key are safe by construction.
  • Scheduled postings - due schedules generate posting batches in one transaction per batch (recurring fees, sweeps, interest).

Finance operations​

  • Balance truth - live and end-of-day balances per denomination; every posting batch is balance-validated before any row is written (422 on imbalance, never compensating entries after the fact).
  • Statement generation - scheduled generation writes documents to platform storage; regeneration is a per-account-period workflow.
  • Config library - flags, restrictions, plans, contract modules: the whole product rule set is data, unit-testable without a DB.

API surface (91 endpoints, selected families)​

FamilyEndpointsScope
AccountsGET/POST /v1/accounts, …/{id}, …/balances, …/transactions, …/statementsbank8:ledger:accounts:read/write
ProductsGET/POST /v1/products, …/{id}/activate, versionsbank8:ledger:products:*
PostingsPOST /v1/postings, POST /v1/postings/async, GET …/{id}, republishbank8:ledger:postings:read/write
Balances v2GET /v2/balances/{live,end,series}bank8:ledger:balances:read
SchedulesGET/POST /v1/schedules, tags, associationsbank8:ledger:schedules:*
CustomersGET/POST /v1/customers, link-authbank8:ledger:customers:write
Parameters/v1/parameters, viewEffective, derived valuesbank8:ledger:parameters:*
Product versions (WASM)POST/GET /v1/products/{id}/versions - per-version WASM registry (wasm_hash, language, hooks); pending → active pointer, no restartbank8:ledger:products:write
Function hooksPOST /v1/contracts/simulate (synthetic-state dry run), POST /v1/internal/func-host (Sentin8:Func proxy-back: get_account, get_balance, set_flag, create_posting)M2M + hook scopes

Invariants​

  • Money is rust_decimal end-to-end; the JSON wire format is a string.
  • Postings are idempotent per (env_id, idempotency_key) - partial unique index + ON CONFLICT.
  • Audit + outbox inserts propagate errors inside the posting transaction: a posting whose audit/event write fails never commits.
  • Product logic is external by construction: hooks compile to WASM and run in Sentin8:Func around the atomic commit - the ledger has no WASM runtime of its own, only the proxy-back handler. Even a hook-initiated posting re-enters the full validation pipeline (unbalanced batches still rejected 422). Read The product factory and Extending Bank8.

Full documentation​

The complete detail lives in this product's sub-pages: