000%

An open-source engineering project exploring precise money, verifiable ledgers and explicit decisions in TypeScript.

Selected work - 02 / Open source

Monetra& Monetra Core

Project overview

Monetra is a self-directed open-source project. It brings precise money values, financial calculations and verifiable ledgers into a TypeScript toolkit. Monetra Core provides the smaller money foundation for applications that do not need the full framework.

Technologies used

TypeScript logoTypeScript
Node.js logoNode.js
GitHub logoGitHub

How the toolkit fits together

One precise value can support different kinds of work.

Input

Amount & currency

A value enters with an explicit currency and precision.

Foundation

Monetra Core

Immutable BigInt money values and explicit rounding.

Path 01 / Calculation

Financial logic

Interest, loans, NPV and other calculations.

Path 02 / Control

Bookkeeping & audit

Double-entry postings, trial balances and hash-chain verification.

Applications can use Core alone or add the full framework for calculations and ledger controls.

( 01 ) - The premise

Money is not a number. It is a value with a currency, a precision and a history.

JavaScript’s default numeric model is convenient, but financial systems cannot accept floating-point drift, silent rounding or a cent disappearing during allocation. Monetra makes those constraints structural: correctness begins in the value object and continues through calculation, bookkeeping and audit. The project shows how I model domain rules, test edge cases and make decisions inspectable.

Exhibits - the premise

Two files · computed in this browser

Precision proof - live arithmetic

driftstrue

IEEE 7540.1 + 0.2 = 0.30000000000000004
Monetramoney(0.1) + money(0.2) = 0.30 · 30 minor units

Explanation

The top line is this browser’s floating-point sum. The bottom line is the same operands through BigInt minor units - no binary float at any step.

Explanation

The same failure shows up when money is divided. Round each share with floating-point and a cent disappears. Allocate in minor units and the parts always recompose to the original.

Allocation - largest remainder

float.sumsfalse

split.sumstrue

People
3

IEEE 754 · toFixed(2)

  • Person 0133.33
  • Person 0233.33
  • Person 0333.33
Recomposed99.99 short 0.01

Monetra · split()

  • Person 0133.34
  • Person 0233.33
  • Person 0333.33
Recomposed100.00

Naive equal divide · requires RoundingMode

Explanation

Giving every person the same rounded share loses the remainder. split() redistributes those leftover minor units so the parts still compose the whole.

Each share33.33

× people99.99

Short0.01

( 02 ) - The ledger

The rules of a physical journal, made executable - and independently verifiable by anyone holding the book.

Append-only · SHA-256

isBalancedtrue

verify()true

AccountDebitCredit
012026-01-04Invoice 1042 - retainer
cash500.00-sales-revenue-500.00
022026-01-06Studio rent - January
rent-expense1 200.00-cash-1 200.00
032026-01-09Workstation - capitalised
equipment2 400.00-cash-2 400.00
Trial balance 0.000.00

Rewrite the debit on entry 02 from 1 200.00 to 1 000.00 - the kind of edit an ordinary mutable record would accept without comment.

Chain intact - every entry hashes to its stored digest

( 03 ) - Layers

Three layers share one definition of value - so modelling, calculation and audit never drift apart.

01

Precision

Immutable BigInt monetary values, ISO 4217 currencies, and explicit rounding - value never passes through floating-point arithmetic.

02

Financial Logic

Interest, loans, amortisation, NPV, IRR and depreciation compose on the same monetary primitives - one model from calculation to report.

03

Audit

Double-entry bookkeeping, trial balances and append-only ledgers with SHA-256 hash-chain verification - controls you can prove, not assert.

( 04 ) - The core

Monetra Core isolates the correctness primitives so precise money can stand alone.

Applications that need precise money without bookkeeping or financial modelling can depend on the smaller package. The split is an architecture call - what must be shared, what should stay small - so the foundation stays focused while the full framework builds richer behaviour on the same semantics.