README.md 1.0 KB

kuatia-core

Pure, sans-IO decision logic for the kuatia ledger.

No async runtime, no IO, near-zero dependencies. Deterministic and testable with golden vectors. Depends only on kuatia-types and sha2.

Modules

Module Purpose
validate validate_and_plan() — single entry point for all invariant checks
hash Double-SHA256, content-addressed transfer IDs, account snapshot hashing
posting_selection Greedy largest-first posting selection for the intent layer

Validation invariants

validate_and_plan() checks, in order:

  1. Non-empty transfer
  2. No duplicate consumed postings
  3. All consumed postings exist
  4. All consumed postings are Active or PendingInactive
  5. All accounts exist, not frozen, not closed
  6. Account snapshot pinning (OCC)
  7. Per-asset conservation: sum(consumed) == sum(created)
  8. Negative postings only on SystemAccount or ExternalAccount
  9. Account policy enforcement (overdraft limits)

Returns a Plan on success, or a ValidationError describing the violation.