Sen descrición

C 8d321e451f Let a caller say which day an entry takes effect hai 3 días
.github ca752e859f Render the doc tree as a book so its diagrams and nav are usable hai 6 días
crates 8d321e451f Let a caller say which day an entry takes effect hai 3 días
doc 8d321e451f Let a caller say which day an entry takes effect hai 3 días
theme ca752e859f Render the doc tree as a book so its diagrams and nav are usable hai 6 días
.gitignore 7e7cfde94d Introduce Kuatia, an append-only, auditable multi-asset ledger hai 4 meses
CHANGELOG.md 8d321e451f Let a caller say which day an entry takes effect hai 3 días
CLAUDE.md 2e22e01d71 Retire the reservation model and the API shapes it left behind hai 4 días
Cargo.lock db22dc4cd6 Store amounts in a form the database can add up exactly hai 2 meses
Cargo.toml 56cd96108d Unbreak clippy on current stable, which flags async_trait's must_use hai 6 días
LICENSE 7e7cfde94d Introduce Kuatia, an append-only, auditable multi-asset ledger hai 4 meses
README.md 2e22e01d71 Retire the reservation model and the API shapes it left behind hai 4 días
book.toml 3066a87107 Give the book an examples section, its only ones being buried away hai 6 días
rust-toolchain.toml 7e7cfde94d Introduce Kuatia, an append-only, auditable multi-asset ledger hai 4 meses

README.md

kuatia

kuatia (kuatiʼa) — Guaraní for paper, document, writing. A fitting name for a small, append-only ledger library.

Auditable, multi-asset UTXO-style ledger in Rust.

Overview

kuatia models value as postings — signed amounts owned by exactly one account. Transfers atomically consume existing postings and create new ones, enforcing per-asset conservation. This gives the same safety guarantee as double-entry bookkeeping (Σ debits = Σ credits), expressed as sum(consumed) == sum(created) per asset over signed postings. There are no mutable balance fields; an account's balance is always the sum of its active postings.

It supports journaling: a committed transfer is a journal entry, a transfer with multiple movements is a compound journal entry (one balanced event touching many accounts, and, since each asset balances independently, many assets), and the append-only transfer log is the accounting journal. Replaying that log reconstructs every balance, so the ledger is auditable by construction. See doc/journaling.md.

┌─────────────────────────────────────────────────────┐
│                   kuatia (async)                    │
│                                                     │
│  Intent layer:  TransferBuilder + commit · balance  │
│  Commit path:   resolve → validate → atomic commit  │
│  Composition:   workflow::run_transfers (LIFO)      │
├─────────────────────────────────────────────────────┤
│               kuatia-core (pure)                    │
│                                                     │
│  Types:         Account · Transfer · Posting · Cent │
│  Validation:    validate_and_plan()                 │
│  Hashing:       double-SHA256, content-addressed    │
│  Selection:     greedy posting selection            │
└─────────────────────────────────────────────────────┘

Crates

Crate Purpose
kuatia-types Domain types — AccountId, Posting, Transfer, Cent, etc.
kuatia-core Pure, sans-IO decision logic — validation, hashing, posting selection.
kuatia-storage Store trait (7 sub-traits), InMemoryStore, store_tests! conformance macro.
kuatia-storage-sql SQL-backed Store — SQLite and PostgreSQL via sqlx.
kuatia Async resource layer: Ledger, the atomic commit engine, intent-layer API.

Quick Example

use kuatia::ledger::Ledger;
use kuatia::mem_store::InMemoryStore;
use kuatia_core::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let ledger = Ledger::new(InMemoryStore::new());

    let usd = AssetId::new(1);
    let alice = AccountId::new(1);
    let bob = AccountId::new(2);
    let bank = AccountId::new(3); // external account

    // Create accounts, deposit, pay...
    // See doc/crates.md for the full API reference.

    Ok(())
}

Documentation

doc/ holds the full documentation: the model, the accounting mapping, the crate and SQL schema reference, and the ADR log.

It is also an mdbook, so the same files render with a table of contents, search, and the mermaid diagrams drawn rather than printed. That needs mdbook and mdbook-mermaid.

cargo install mdbook mdbook-mermaid
mdbook serve                       # localhost:3000
mdbook build                       # into target/book

License

See LICENSE for details.