Documentation

How doubleentry keeps books you can prove: start in memory, learn the model, read reports, run it in production, and check every guarantee.

Start gets a ledger running, in memory and over a database. Concepts is the bookkeeping model. Reporting reads the books back. Operating keeps them in production. Assurance says why they can be trusted, and how to check.

Every Rust block on this site is compiled and run in CI against the crate. Signatures are in the API reference on docs.rs.

Start

From the first entry in memory to durable books in a database: install, record, handle errors, pick features.

  1. Getting started Install the crate, set up a Journal, record a balanced entry, read a balance, prove the entry, seal and audit.
  2. With a database The same calls on a Ledger over SQLite: create or open, retry safely, keep books durable.
  3. Errors The one Error type, its nine variants, stable rejection codes, and what to retry.
  4. Features and MSRV Cargo features, what each adds, TLS for PostgreSQL, and the MSRV policy.

Concepts

The bookkeeping model: money, accounts, entries, validation, identity, corrections, holds, periods and seals.

  1. Money Amount<P>: exact i128 money, declared currency exponents, explicit rounding, exact splits.
  2. Accounts Account paths, kinds and classes, open windows, limits, and master data as dated log records.
  3. Entries Drafts by path, postings, layers, dimensions, documents, memo commitments, rates, value dates.
  4. Debits and credits Sides, gross balances that only grow, and the derived net.
  5. Validation The rule core's five stages, their precedence, and the one Rejection every façade and store returns.
  6. Idempotency The idempotency key is the entry's identity: derived ids, replays, key conflicts, and the draft fingerprint.
  7. Corrections Nothing is edited: a correction is a reversal that mirrors the wrong entry exactly, booked in an open period.
  8. Holds Two-phase transfers: open a hold, then post, void or expire it exactly once; outstanding holds count against balance limits.
  9. Periods and seals A contiguous calendar of periods, seals that commit every balance through a period's end, and the watermark below which nothing changes.

Reporting

Reading the books: balances, statements, assertions, rollups, dimensions, open items, closing and export.

  1. Balances and trial balances BalanceQuery, balance and trial_balance on either façade, and how reports render.
  2. Statements and assertions Account statements with an opening balance and lines in date order, and balance assertions that report expected, actual and the difference.
  3. Rollup A trial balance folded up the account-path tree: subtotals per path prefix, inferred grouping nodes, cut to any depth.
  4. Dimensions Caller-named reporting axes on postings, required dimensions, and dimension-filtered reads.
  5. Open items Clearings as log records: apply and reset, and the open items an account still carries.
  6. Year-end closing close_year: closing entries per account and dimension slice, returned as drafts for you to record.
  7. Export Flat, verifiable rows for an auditor: Konto/Gegenkonto pairing, minor units, and a rebuildable root.

Operating

Running books in production: stores and their schema, PostgreSQL, backups, privacy and performance.

  1. Stores MemoryStore, SQLite and PostgreSQL: one contract, one writer per ledger, reads that never block, a schema identifier checked on open.
  2. PostgreSQL Roles and privileges, creating the schema once, triggers, the advisory lock, TLS, and isolation.
  3. Backup and restore Back up with the database's own tools, then audit() the restored books before writing.
  4. Privacy Memo erasure for GDPR Art. 17, and why every other field must not carry personal data.
  5. Performance The benchmarks behind write throughput, proof and audit costs, reports and Journal memory, and how to run them.

Assurance

Why the books can be trusted, and how to check: the log, proofs, transparency, audit, testing, GoBD and the design.

  1. The log One RFC 6962 SHA-256 Merkle log of typed records, its canonical encoding, and what a position means.
  2. Proofs Inclusion, consistency and sealed-balance proofs against a tree head, and what they read.
  3. Transparency Signed C2SP checkpoints, stock witnesses, policies, the auditor's Verifier, tiles and offline proof bundles.
  4. Audit audit() replays the log through the rule core and compares every persisted table.
  5. Testing and evidence Conformance, simulation, concurrency, property tests, golden and interop vectors, fuzz targets, and compiled docs.
  6. GoBD A compliance matrix for German tax auditors, and notes for the Verfahrensdokumentation.
  7. Design The principles behind the crate, and what is deliberately not in it.