--- language: - en license: apache-2.0 tags: - sovereign - snapkitty - programming-language - deterministic - ledger - cryptography - sha256 - mumps - ibm-i - worm-sealed - zero-dependencies - pure-python - formal-verification task_categories: - text-generation size_categories: - n<1K pretty_name: MANTRA — Deterministic Auditable Language --- # MANTRA **A deterministic, auditable programming language for ledger operations, cryptographic sealing, and verified integer computation.** Zero external dependencies. Pure Python. Auditable SHA-256. MUMPS gateway. SnapKitty West / SNAPKITTYWEST — *Evidence or Silence — 2026* --- ## What It Is MANTRA is a purpose-built language for sovereign ledger operations. Every computation is deterministic and traceable. Every output can be cryptographically sealed. No external dependencies — the SHA-256 implementation is pure Python and auditable line by line. ``` # Constants and variables const GENESIS = "0000000000000000000000000000000000000000000000000000000000000000" let amount = 450000 # Annotated deterministic function @deterministic define seal(tx) let h = sha256(tx) Result::ok(h) end # Run python mantra.py run examples/ledger.m python mantra.py hash "hello world" ``` --- ## Test Status | Suite | Tests | |---|---| | test_sha256 | passing | | test_integer | passing | | test_bytes | passing | | test_evaluator | passing | | **Total** | **23/23** | --- ## Architecture ``` mantra/ ├── mantra.py CLI (run / eval / hash / test) ├── lexer/lexer.py Tokenizer (HEX, BYTES, annotations, keywords) ├── mantra_ast/nodes.py AST dataclasses ├── parser/parser.py Pratt parser + field access + dict literals ├── runtime/ │ ├── types.py Integer, Boolean, Bytes, String, DictValue, Option, Result │ ├── evaluator.py Tree-walking evaluator with closures + builtins │ ├── runtime.py run_source / run_file │ └── stdlib/ │ ├── integer.py add/sub/mul/div/mod/pow with overflow checking │ ├── bit.py band/bor/bxor/bnot/shl/shr/rotl/rotr │ ├── bytes.py concat/slice/len/get_byte │ ├── string.py to_bytes/from_bytes/concat │ ├── hex.py bytes_to_hex/hex_to_bytes │ ├── sha256.py sha256/sha256_hex (wraps auditable impl) │ ├── collections.py list_len/list_get/dict_get │ ├── result.py ok/err/some/none │ └── testing.py assert_eq/assert_true/assert_false ├── sha256/ │ ├── sha256_impl.py Pure-Python SHA-256 (no hashlib, fully auditable) │ └── vectors.py NIST canonical test vectors ├── gateway/ │ └── mumps_gateway.py 300-byte binary record pack/unpack/dispatch (IBM i bridge) └── examples/ ├── ledger.m Transaction seal (end-to-end working) └── treasury.m Multi-step ledger chain ``` --- ## Key Properties | Property | Detail | |---|---| | Deterministic | Same inputs always produce same outputs | | Auditable SHA-256 | Pure Python, no hashlib, every round visible | | Zero dependencies | Nothing to install beyond Python 3.10+ | | MUMPS gateway | 300-byte binary record bridge to IBM i | | Fail-closed types | Option and Result — no silent nulls | | Overflow checking | Integer arithmetic bounds-checked | --- ## License Trilicensed: Apache-2.0 / MIT / Sovereign-Source-1.0 (see `LICENSES/`) --- ## Related Repos | Repo | Description | |---|---| | [SNAPKITTYWEST/sov](https://huggingface.co/datasets/SNAPKITTYWEST/sov) | Sovereign Package Switchboard | | [SNAPKITTYWEST/devflow-finance-twin](https://huggingface.co/datasets/SNAPKITTYWEST/devflow-finance-twin) | IBM i BaaS ledger stack | | [SNAPKITTYWEST/sovereign-training-corpus](https://huggingface.co/datasets/SNAPKITTYWEST/sovereign-training-corpus) | Training corpus | | [GitHub](https://github.com/SNAPKITTYWEST/mantra) | Source repository |