Tamper-Evident Ledger

Bills, payments, refunds and voids written as a hash-chained event log. Change, delete or rewrite any row and verification points straight at it.

Kaihuan HuangMoney rules from the POS work I owned at IPOT; hash chain from my governance-platform rebuildIndependent reimplementation · all data is synthetic

1. Run a shift

Each action is checked against the current balances, then becomes exactly one event, or is refused with a reason. Refused actions write nothing.

Try a refund yourself

Run the shift first so there are payments to refund.

2. The ledger

Each event stores the hash of the one before it, so every row vouches for all rows above it. An anchor copies the latest hash somewhere the database can't reach, like an end-of-day report.

No anchors yet.
#EventByDetailsPrevious → hash
Empty.

3. Try to cheat

Pretend you have write access to the database and want the $9.00 refund to look like $1.00, or the void to disappear.

Change a number

Edit the refund amount in place.

Delete a row

Remove the void from history.

Rewrite and re-hash

Change the refund, then recompute every hash after it so the chain looks whole.

4. Balances rebuilt from the ledger

Nothing below is stored. Every figure is recomputed from the events, in integer cents, each time the ledger changes.

BillTableStatusTotalPayment

Checks

5. Tests

Money rules and tamper detection, run in your browser against the code on this page.

Where the rules come from