Skip to content
Try Hanzo
Language: English (United States)

HanzoLedger

A double-entry ledger you post to over HTTP. Money here only ever moves: a posting names a source account, a destination account, an amount and an asset. There is no way to write a debit without its credit, because a one-sided entry is not something the API can express.

Double-Entry LedgerBalanced by construction01 / 03
@world−10,000may go below zero
@users:00110,000stays at or above zero
@merchants:0420stays at or above zero
@platform:fees0stays at or above zero

journalUSD/2

  1. tx 1

    @world→@users:00110,000

    Σ 0

new money enters through world

One transaction, however many parties

Numscript

Split it yourselfΣ 0

10,000 in USD/2, the smallest unit: whole numbers, nothing rounds on the way in

@users:001→@merchants:0429,500

@users:001→@platform:fees500

sent10,000received10,000

@world−10,000

@users:0010

@merchants:0429,500

@platform:fees500

send [USD/2 10000] (
  source = @users:001
  destination = { 95% to @merchants:042
                  5% to @platform:fees }
)

Every cent lands somewhere

  1. Balanced by construction

    01 / 03

    A posting is a movement from one account to another, so an unbalanced entry is not rejected by a check — it cannot be written down. New money enters through one account named world; every other account must stay at or above zero, and a transaction that would push one under is refused whole.

    source@users:001

    destination@merchants:042

    amount9500

    assetUSD/2

    Σ 0debit and credit, one movement

  2. Nothing is edited

    02 / 03

    No endpoint changes a posted transaction. A mistake is corrected by a reversing transaction that points back at the original, so what happened and what you meant both survive. Entries can also be SHA-256 chained, each hashed over the one before it, which makes a later edit in the database detectable rather than invisible.

    a reversing transaction points back at the original

  3. Safe to retry

    03 / 03

    Send an Idempotency-Key and a repeat returns the original rather than posting again. The ledger also fingerprints what you sent, so reusing a key with different postings is caught instead of quietly accepted — which is the failure that makes retries dangerous in the first place.

    POSTIdempotency-Key: order_42_payouttx 2
    POSTIdempotency-Key: order_42_payoutthe original — tx 2
    POSTIdempotency-Key: order_42_payoutdifferent postings — caught

    1transaction 2, posted once

What the API gives you

Capabilities

Numscript

Describe the movement instead of computing it. Send an amount from an account and split it across destinations by percentage, nesting splits inside splits. The whole flow posts as one transaction, so a fee that cannot be taken takes the payment with it.

send [USD/2 10000] (
  source = @users:001
  destination = { 95% to @merchants:042
                   5% to @platform:fees }
)

@merchants:0429,500

@platform:fees500

tx 2Σ 0

Get Ledger

Double-entry accounting ledger

License:
Apache-2.0

Paste and ship

Paste this into any agent. It reads the skill manifest and calls Ledger from there.

Agent prompt
Read https://hanzo.ai/skill.md and use Hanzo Ledger in my project.

Get startedwith Ledger

Post your first transaction over HTTP, or describe the whole split once in Numscript and let the ledger do the arithmetic.