Files
skills/public/hanzo-ledger.html
zeekayandHanzo Dev 9e10c1c10e Each llms index points at the other two
hanzoskills.com/llms.txt now opens with the install line, the API
reference index and the company index, so an agent that lands on any
one of the three can find the rest.

robots.txt claimed 537 documents while llms.txt counts 920. The number
is gone from robots.txt; llms.txt derives it.

public/ is regenerated from scripts/site.py, which it had fallen
behind: the copy-prompt menu and agent bar were in the generator and
not in the committed pages. tests/site.mjs passes against the result.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-11 00:27:59 -07:00

385 lines
25 KiB
HTML

<!doctype html>
<html lang="en"><head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>hanzo-ledger</title>
<meta name="color-scheme" content="dark">
<style>
/* Committed to one visual world: a dark instrument panel. No light variant —
the dot field and the hairline rules only read on black, and a naive
inversion would wash both out. Every colour is painted explicitly so the page
never borrows a host background. */
@font-face{font-family:'Zen';src:url('/fonts/Zen-Variable.woff2') format('woff2');font-weight:100 900;font-style:normal;font-display:swap}
@font-face{font-family:'Zen';src:url('/fonts/Zen-Italic-Variable.woff2') format('woff2');font-weight:100 900;font-style:italic;font-display:swap}
@font-face{font-family:'Zen Mono';src:url('/fonts/ZenMono-Variable.woff2') format('woff2');font-weight:100 900;font-style:normal;font-display:swap}
@font-face{font-family:'Zen Mono';src:url('/fonts/ZenMono-Italic-Variable.woff2') format('woff2');font-weight:100 900;font-style:italic;font-display:swap}
@font-face{font-family:'Zen Pixel Square';src:url('/fonts/ZenPixel-Square.woff2') format('woff2');font-style:normal;font-display:swap}
:root{
--ink:#f4f4f2; --soft:#9c9c98; --faint:#6a6a66; --ground:#000; --panel:#0a0a0a;
--line:#232323; --line-hi:#3a3a3a; --accent:#f4f4f2;
--font-zen-sans:'Zen',-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif;
--font-zen-mono:'Zen Mono',ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
--font-zen-pixel-square:'Zen Pixel Square',monospace;
--mono:var(--font-zen-mono);
--sans:var(--font-zen-sans);
/* Controls are pills and surfaces are soft, as on hanzo.ai. */
--r:999px; --r-soft:14px;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--ground);color:var(--ink);font-family:var(--sans);
font-size:16px;line-height:1.65;-webkit-font-smoothing:antialiased}
.wrap{max-width:60rem;margin:0 auto;padding:0 1.75rem}
/* The dot field. A halftone made of one repeating radial-gradient, faded out
along the diagonal by a mask so it reads as a wave rather than wallpaper. */
/* No overflow clip here: the dot field is inset to the box already, and a clip
would cut off the copy-prompt menu. */
.hero{position:relative;border-bottom:1px solid var(--line)}
.hero::before{content:"";position:absolute;inset:0;
background-image:radial-gradient(var(--line-hi) 1px, transparent 1px);
background-size:7px 7px;
-webkit-mask-image:linear-gradient(115deg,#000 0%,rgba(0,0,0,.55) 38%,transparent 72%);
mask-image:linear-gradient(115deg,#000 0%,rgba(0,0,0,.55) 38%,transparent 72%);
pointer-events:none}
.hero .wrap{position:relative;padding-top:5.5rem;padding-bottom:4rem}
nav{border-bottom:1px solid var(--line)}
nav .in{max-width:60rem;margin:0 auto;padding:1.1rem 1.75rem;display:flex;
justify-content:space-between;align-items:center;gap:1rem}
.brand{font-family:var(--mono);font-size:.85rem;letter-spacing:.14em;
text-transform:uppercase;color:var(--ink);text-decoration:none;
display:inline-flex;align-items:center;gap:.6rem}
.brand i{font-style:normal;color:var(--faint)}
.mark{width:1.15em;height:1.15em;display:block;flex:0 0 auto}
nav a.up{font-family:var(--mono);font-size:.72rem;letter-spacing:.14em;
text-transform:uppercase;color:var(--soft);text-decoration:none}
nav a.up:hover{color:var(--ink)}
h1{font-family:var(--mono);font-size:clamp(2rem,5.4vw,3.4rem);line-height:1.12;
letter-spacing:-.02em;margin:0 0 1.1rem;font-weight:500;text-wrap:balance}
h1 em{font-style:normal;color:var(--faint)}
.lede{color:var(--soft);font-size:1.05rem;max-width:52ch;margin:0 0 2.25rem}
.btns{display:flex;flex-wrap:wrap;gap:.7rem;margin:0 0 .5rem;align-items:center}
.btn{display:inline-flex;align-items:center;gap:.5rem;font-family:var(--mono);
font-size:.72rem;letter-spacing:.14em;text-transform:uppercase;
padding:.8rem 1.4rem;border:1px solid var(--line-hi);border-radius:var(--r);
color:var(--ink);text-decoration:none;background:transparent;cursor:pointer;
line-height:1.2;font-weight:400}
.btn:hover{background:#141414;text-decoration:none;border-color:var(--soft)}
.btn.solid{background:var(--ink);color:#000;border-color:var(--ink)}
.btn.solid:hover{background:#d8d8d4}
.btn .chev{width:.7em;height:.7em;flex:0 0 auto;transition:transform .15s ease}
.btn[aria-expanded="true"] .chev{transform:rotate(180deg)}
/* Copy-prompt selector. Each row copies the prompt for its own target. */
.copy{position:relative;display:inline-flex}
.menu{position:absolute;top:calc(100% + .5rem);left:0;z-index:20;min-width:21rem;
background:var(--panel);border:1px solid var(--line-hi);border-radius:var(--r-soft);
padding:.4rem;display:flex;flex-direction:column;
box-shadow:0 12px 32px rgba(0,0,0,.75)}
.menu[hidden]{display:none}
.mi{display:flex;align-items:center;gap:.7rem;width:100%;text-align:left;
padding:.62rem .8rem;border:0;border-radius:calc(var(--r-soft) - .35rem);
background:transparent;color:var(--ink);font-family:var(--mono);font-size:.76rem;
letter-spacing:.04em;text-decoration:none;cursor:pointer;line-height:1.3;
white-space:nowrap}
.mi:hover,.mi:focus-visible{background:#181818;outline:none}
.mi .mark{width:1.05rem;height:1.05rem;color:var(--soft)}
.mi:hover .mark{color:var(--ink)}
.mi u{margin-left:auto;color:var(--faint);text-decoration:none;font-size:.68rem;
letter-spacing:.1em;text-transform:uppercase}
/* Works-with bar: one scrolling row, name and mark per agent. */
.strip{border-bottom:1px solid var(--line);background:var(--panel)}
.strip .in{max-width:60rem;margin:0 auto;padding:.9rem 1.75rem;display:flex;
align-items:center;gap:1.25rem;font-family:var(--mono);font-size:.72rem;
letter-spacing:.1em;text-transform:uppercase;color:var(--faint)}
.strip b{color:var(--soft);font-weight:400;flex:0 0 auto;
border-right:1px solid var(--line);padding-right:1.25rem;align-self:stretch;
display:flex;align-items:center}
.bar{display:flex;align-items:center;gap:.5rem;flex:1 1 auto;min-width:0;
overflow-x:auto;scrollbar-width:none;scroll-snap-type:x proximity;
-webkit-overflow-scrolling:touch;
-webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 3rem),transparent);
mask-image:linear-gradient(90deg,#000 calc(100% - 3rem),transparent)}
.bar::-webkit-scrollbar{display:none}
.agent{display:inline-flex;align-items:center;gap:.45rem;flex:0 0 auto;
padding:.4rem .85rem;border:1px solid var(--line);border-radius:var(--r);
color:var(--soft);white-space:nowrap;scroll-snap-align:start;
text-decoration:none;background:var(--ground)}
.agent:hover{color:var(--ink);border-color:var(--line-hi);text-decoration:none}
.agent .mark{width:.95rem;height:.95rem}
h2{font-family:var(--mono);font-size:1.1rem;letter-spacing:-.01em;margin:2.75rem 0 .75rem;font-weight:500}
h3{font-size:1rem;margin:2rem 0 .5rem;font-weight:600}
h4,h5,h6{font-size:.94rem;margin:1.5rem 0 .5rem;font-weight:600}
p{margin:0 0 1rem;max-width:70ch}
ul,ol{margin:0 0 1rem;padding-left:1.35rem;max-width:70ch}
li{margin:.22rem 0}
a{color:var(--ink);text-decoration:underline;text-underline-offset:3px;
text-decoration-color:var(--line-hi)}
a:hover{text-decoration-color:var(--ink)}
a:focus-visible{outline:1px solid var(--ink);outline-offset:3px}
code{font-family:var(--mono);font-size:.85em;background:var(--panel);
border:1px solid var(--line);border-radius:5px;padding:.1em .36em}
pre{background:var(--panel);border:1px solid var(--line);padding:1rem 1.1rem;
border-radius:var(--r-soft);overflow-x:auto;margin:0 0 1.25rem}
pre code{background:none;border:0;padding:0;font-size:.82rem;line-height:1.7}
blockquote{margin:0 0 1rem;padding-left:1rem;border-left:1px solid var(--line-hi);color:var(--soft)}
hr{border:0;border-top:1px solid var(--line);margin:2.5rem 0}
table{border-collapse:collapse;width:100%;margin:0 0 1.25rem;font-size:.92rem;
display:block;overflow-x:auto}
th,td{border:1px solid var(--line);padding:.5rem .7rem;text-align:left}
.curl{display:block;background:var(--panel);border:1px solid var(--line);
border-radius:var(--r-soft);padding:.95rem 1.1rem;font-family:var(--mono);
font-size:.8rem;color:var(--soft);overflow-x:auto;margin:0 0 2.5rem;
white-space:pre;line-height:1.9}
.curl b{color:var(--ink);font-weight:400}
.curl i{font-style:normal;color:var(--faint)}
/* index */
#q{width:100%;padding:.85rem 1.2rem;font-family:var(--mono);font-size:.85rem;color:var(--ink);
background:var(--panel);border:1px solid var(--line);border-radius:var(--r);margin:0 0 .6rem}
#q::placeholder{color:var(--faint);text-transform:uppercase;letter-spacing:.1em;font-size:.72rem}
#q:focus{outline:none;border-color:var(--soft)}
#count{color:var(--faint);font-family:var(--mono);font-size:.72rem;letter-spacing:.1em;
text-transform:uppercase;margin:0 0 2rem}
.cat{margin:2.5rem 0 .5rem;font-family:var(--mono);font-size:.7rem;letter-spacing:.16em;
text-transform:uppercase;color:var(--faint);border-bottom:1px solid var(--line);
padding-bottom:.45rem}
.row{display:block;padding:.6rem .9rem;margin:0 -.9rem;border-bottom:1px solid var(--line);
border-radius:var(--r-soft);text-decoration:none}
.row:hover{background:#0a0a0a}
.nm{font-family:var(--mono);font-size:.84rem;color:var(--ink);display:block}
.ds{color:var(--soft);font-size:.9rem;display:block;margin-top:.12rem}
footer{margin-top:4rem;padding:2rem 0 4rem;border-top:1px solid var(--line);
color:var(--faint);font-size:.85rem}
footer a{color:var(--soft)}
.fmap{display:grid;gap:1.75rem;grid-template-columns:repeat(auto-fit,minmax(11rem,1fr));
margin:0 0 2rem;font-size:.85rem}
.fmap b{display:block;font-family:var(--mono);font-size:.68rem;letter-spacing:.16em;
text-transform:uppercase;color:var(--faint);font-weight:400;margin:0 0 .6rem;
border-bottom:1px solid var(--line);padding-bottom:.4rem}
.fmap a{display:inline-block;color:var(--ink);text-decoration:none;margin:.3rem .35rem 0 0}
.fmap a:hover{text-decoration:underline}
.fmap div{color:var(--faint);line-height:1.5}
.fend{border-top:1px solid var(--line);padding-top:1.25rem;font-size:.82rem}
@media (max-width:640px){
.hero .wrap{padding-top:3.25rem;padding-bottom:2.75rem}
.btns{gap:.5rem}
.btn{padding:.75rem 1.15rem;font-size:.68rem}
.copy,.copy .btn{width:100%;justify-content:center}
.menu{left:0;right:0;min-width:0}
.strip .in{flex-direction:column;align-items:flex-start;gap:.6rem;padding:.9rem 1.75rem}
.strip b{border-right:0;padding-right:0}
.bar{width:100%}
}
</style>
<link rel="alternate" type="text/markdown" href="/hanzo-ledger.md">
<link rel="icon" href="/favicon.svg">
<link rel="canonical" href="https://hanzoskills.com/hanzo-ledger">
</head>
<!-- Reading this with a machine? Every page here is also plain markdown.
This one: https://hanzoskills.com/hanzo-ledger.md
Index: https://hanzoskills.com/llms.txt
Corpus: https://hanzoskills.com/all.md
Append .md to any path for the markdown twin. -->
<body>
<nav><div class="in">
<a class="brand" href="/"><svg class="mark" viewBox="0 0 67 67" fill="currentColor" aria-hidden="true"><path d="M22.21 67V44.6369H0V67H22.21Z"/><path d="M66.7038 22.3184H22.2534L0.0878906 44.6367H44.4634L66.7038 22.3184Z"/><path d="M22.21 0H0V22.3184H22.21V0Z"/><path d="M66.7198 0H44.5098V22.3184H66.7198V0Z"/><path d="M66.7198 67V44.6369H44.5098V67H66.7198Z"/></svg> HANZO<i>SKILLS</i></a>
<a class="up" href="/">All skills</a>
</div></nav>
<div class="wrap">
<h1>hanzo-ledger</h1><p class="lede">Hanzo Ledger is a programmable double-entry financial ledger written in Go.</p><h1>Hanzo Ledger - Programmable Double-Entry Financial Ledger</h1>
<p><strong>Category</strong>: Hanzo Ecosystem <strong>Related Skills</strong>: <code>hanzo/hanzo-vault.md</code>, <code>hanzo/hanzo-commerce-api.md</code>, <code>hanzo/hanzo-commerce.md</code></p>
<h2>Overview</h2>
<p>Hanzo Ledger is a <strong>programmable double-entry financial ledger</strong> written in Go. It provides atomic multi-posting transactions, account-based modeling, and a scriptable DSL called <a href="https://github.com/hanzoai/numscript">Numscript</a> for expressing complex money movements. Fork of Formance Ledger (Go module still <code>github.com/formancehq/ledger</code>).</p>
<h3>Why Hanzo Ledger?</h3>
<ul><li><strong>Double-Entry</strong> -- Every transaction balances. No money created or destroyed.</li><li><strong>Multi-Posting</strong> -- Atomic transactions across unlimited accounts in a single operation</li><li><strong>Numscript DSL</strong> -- Model complex splits, fees, and routing with a purpose-built language</li><li><strong>Immutable Audit Trail</strong> -- Append-only ledger with full transaction history</li><li><strong>Multi-Currency</strong> -- Native support for any asset type with arbitrary precision (<code>big.Int</code>)</li><li><strong>Multi-Ledger</strong> -- Run multiple isolated ledgers from a single instance</li><li><strong>Chart of Accounts</strong> -- Schema enforcement with variable segments and regex patterns</li><li><strong>Replication</strong> -- Built-in data export pipelines with gRPC worker support</li></ul>
<h3>Architecture</h3>
<pre><code>hanzo/commerce Storefront, catalog, orders
|
hanzo/payments Payment routing (50+ processors)
|
hanzo/treasury Ledger, reconciliation, wallets &lt;-- this
|
lux/treasury On-chain treasury, MPC/KMS wallets</code></pre>
<h2>When to use</h2>
<ul><li>Recording financial transactions with strict double-entry guarantees</li><li>Multi-party fee splits and revenue sharing</li><li>E-commerce order payments, refunds, and wallet balances</li><li>Internal transfer accounting between services</li><li>Multi-currency or multi-asset tracking (fiat, crypto, credits, points)</li><li>Audit-compliant financial record keeping</li></ul>
<h2>Hard requirements</h2>
<ol><li><strong>PostgreSQL</strong> (16+ recommended) for transaction storage</li><li><strong>Go 1.24+</strong> for building from source</li><li><strong>Docker</strong> for local development (compose includes Postgres, Prometheus, Jaeger, OTEL collector)</li></ol>
<h2>Quick reference</h2>
<p>| Item | Value | |------|-------| | Language | Go | | Go Module | <code>github.com/formancehq/ledger</code> | | API | HTTP REST (chi router) | | Port | 3068 | | Database | PostgreSQL (via uptrace/bun ORM) | | API Versions | v1 (legacy), v2 (current), v3 (OpenAPI spec exists) | | CLI Commands | <code>serve</code>, <code>worker</code>, <code>buckets upgrade</code>, <code>version</code>, <code>docs</code> | | Event Bus | Watermill (NATS, Kafka, HTTP) | | Observability | OpenTelemetry (traces + metrics), Prometheus, Jaeger | | Repo | <code>github.com/hanzoai/ledger</code> | | License | MIT |</p>
<h2>API Reference</h2>
<h3>Create a Transaction</h3>
<pre><code class="lang-http">POST /v2/ledger/{name}/transactions
Content-Type: application/json
{
&quot;postings&quot;: [{
&quot;source&quot;: &quot;world&quot;,
&quot;destination&quot;: &quot;users:001&quot;,
&quot;amount&quot;: 10000,
&quot;asset&quot;: &quot;USD/2&quot;
}]
}</code></pre>
<h3>Create Transaction with Numscript</h3>
<pre><code class="lang-http">POST /v2/ledger/{name}/transactions
Content-Type: application/json
{
&quot;script&quot;: {
&quot;plain&quot;: &quot;send [USD/2 10000] (\n source = @users:001\n destination = {\n 90% to @merchants:042\n 10% to @platform:fees\n }\n)&quot;
}
}</code></pre>
<h3>List Transactions</h3>
<pre><code class="lang-http">GET /v2/ledger/{name}/transactions</code></pre>
<h3>Get Account Balance</h3>
<pre><code class="lang-http">GET /v2/ledger/{name}/accounts/{address}</code></pre>
<h3>Set Account Metadata</h3>
<pre><code class="lang-http">POST /v2/ledger/{name}/accounts/{address}/metadata
Content-Type: application/json
{
&quot;role&quot;: &quot;merchant&quot;,
&quot;tier&quot;: &quot;gold&quot;
}</code></pre>
<h3>Revert a Transaction</h3>
<pre><code class="lang-http">POST /v2/ledger/{name}/transactions/{id}/revert</code></pre>
<h3>Bulk Operations</h3>
<pre><code class="lang-http">POST /v2/ledger/{name}/bulk
Content-Type: application/json
[
{&quot;action&quot;: &quot;CREATE_TRANSACTION&quot;, &quot;data&quot;: {&quot;postings&quot;: [...]}},
{&quot;action&quot;: &quot;ADD_METADATA&quot;, &quot;data&quot;: {&quot;targetType&quot;: &quot;ACCOUNT&quot;, &quot;targetID&quot;: &quot;users:001&quot;, &quot;metadata&quot;: {...}}}
]</code></pre>
<h3>Health and Info</h3>
<pre><code class="lang-http">GET /_healthcheck
GET /_/info
GET /_/metrics</code></pre>
<h2>Numscript DSL</h2>
<p>Numscript is a purpose-built language for expressing money movements.</p>
<pre><code class="lang-numscript">// Simple transfer
send [USD/2 10000] (
source = @users:001
destination = @merchants:042
)
// Multi-party fee split
send [USD/2 10000] (
source = @users:001
destination = {
90% to @merchants:042
10% to {
50% to @platform:fees
50% to @platform:reserve
}
}
)</code></pre>
<ul><li><code>@world</code> is a special unlimited source (money creation)</li><li>Assets use format <code>CURRENCY/precision</code> (e.g., <code>USD/2</code> = cents)</li><li>Parsed via ANTLR4 grammar, executed by internal machine</li></ul>
<h2>Core Concepts</h2>
<h3>Accounts</h3>
<p>Hierarchical addresses separated by colons: <code>users:001</code>, <code>merchants:042:fees</code>. The special account <code>world</code> is an unlimited source.</p>
<h3>Postings</h3>
<p>Each posting moves an amount of an asset from source to destination:</p>
<pre><code class="lang-go">type Posting struct {
Source string // source account address
Destination string // destination account address
Amount *big.Int // amount (arbitrary precision)
Asset string // asset identifier (e.g., &quot;USD/2&quot;)
}</code></pre>
<h3>Volumes</h3>
<p>Every account tracks input/output volumes per asset. Balance = Input - Output.</p>
<h3>Ledgers and Buckets</h3>
<p>Multiple ledgers can share a single database (bucket). Each ledger has independent accounts, transactions, and metadata. Bucket names and ledger names must match <code>^[0-9a-zA-Z_-]{1,63}$</code>.</p>
<h3>Chart of Accounts</h3>
<p>Optional schema enforcement. Define allowed account structures with fixed segments, variable segments (<code>$variable</code>), and regex patterns.</p>
<h3>Features</h3>
<p>Per-ledger configurable features:</p>
<p>| Feature | Options | Default | |---------|---------|---------| | <code>MOVES_HISTORY</code> | ON, OFF | ON | | <code>MOVES_HISTORY_POST_COMMIT_EFFECTIVE_VOLUMES</code> | SYNC, DISABLED | SYNC | | <code>HASH_LOGS</code> | SYNC, ASYNC, DISABLED | SYNC | | <code>ACCOUNT_METADATA_HISTORY</code> | SYNC, DISABLED | SYNC | | <code>TRANSACTION_METADATA_HISTORY</code> | SYNC, DISABLED | SYNC |</p>
<h2>Development</h2>
<h3>Build and Test</h3>
<pre><code class="lang-bash">go build ./...
go test ./...
# With integration tests
go test -tags it ./...
# Full test with coverage
just tests</code></pre>
<h3>Local Development with Docker</h3>
<pre><code class="lang-bash">docker compose up -d
# Ledger available at http://localhost:3068</code></pre>
<p>Docker compose includes: PostgreSQL 16, Prometheus, Jaeger, OTEL collector, ledger server, and worker.</p>
<h3>Task Runner (Justfile)</h3>
<pre><code class="lang-bash">just # list available commands
just lint # golangci-lint
just tidy # go mod tidy
just generate # go generate
just tests # full test suite with coverage
just openapi # regenerate OpenAPI spec
just generate-client # regenerate Go client SDK (requires SPEAKEASY_API_KEY)
just pre-commit # tidy + generate + lint + openapi (run before commits)</code></pre>
<h3>Project Structure</h3>
<pre><code>ledger/
cmd/ CLI commands (serve, worker, buckets, docs, version)
internal/
api/ HTTP API (v1, v2 routers, bulking)
bus/ Event publishing (Watermill)
controller/ Business logic (ledger + system controllers)
machine/ Numscript execution engine
queries/ Query building
replication/ Data export pipelines (gRPC, drivers)
storage/ PostgreSQL storage layer (bun ORM)
tracing/ OpenTelemetry instrumentation
pkg/
accounts/ Account address validation
assets/ Asset format validation
client/ Generated Go client SDK (Speakeasy)
events/ Event type definitions
features/ Feature flag definitions
openapi/ OpenAPI specs (v1, v2, v3)
deployments/ Docker Compose + Pulumi configs
examples/ Example setups (standalone, publisher-http, publisher-kafka)
docs/ Generated documentation
tools/ Build tooling</code></pre>
<h2>Configuration</h2>
<h3>Environment Variables</h3>
<p>| Variable | Description | Default | |----------|-------------|---------| | <code>POSTGRES_URI</code> | PostgreSQL connection string | required | | <code>POSTGRES_MAX_OPEN_CONNS</code> | Max open connections | -- | | <code>POSTGRES_MAX_IDLE_CONNS</code> | Max idle connections | -- | | <code>POSTGRES_CONN_MAX_IDLE_TIME</code> | Connection max idle time | -- | | <code>AUTO_UPGRADE</code> | Auto-upgrade schemas on start | false | | <code>EXPERIMENTAL_FEATURES</code> | Enable feature configurability | false | | <code>BULK_PARALLEL</code> | Bulk operation parallelism | 10 | | <code>DEBUG</code> | Enable debug mode | false |</p>
<h3>CLI Flags (serve command)</h3>
<p>| Flag | Description | Default | |------|-------------|---------| | <code>--bind</code> | API bind address | <code>0.0.0.0:3068</code> | | <code>--auto-upgrade</code> | Auto-upgrade schemas | false | | <code>--numscript-cache-max-count</code> | Numscript cache size | 1024 | | <code>--bulk-max-size</code> | Max bulk operation size | 100 | | <code>--bulk-parallel</code> | Bulk parallelism | 10 | | <code>--default-page-size</code> | Default pagination size | 15 | | <code>--max-page-size</code> | Max pagination size | 100 | | <code>--worker</code> | Enable embedded worker | false | | <code>--schema-enforcement-mode</code> | Schema enforcement (<code>audit</code>, <code>strict</code>) | audit |</p>
<h2>Key Dependencies</h2>
<p>| Package | Purpose | |---------|---------| | <code>github.com/formancehq/numscript</code> | Numscript DSL parser/interpreter | | <code>github.com/formancehq/go-libs/v4</code> | Shared library (auth, ORM, health, OTLP, publishing) | | <code>github.com/go-chi/chi/v5</code> | HTTP router | | <code>github.com/uptrace/bun</code> | PostgreSQL ORM | | <code>github.com/jackc/pgx/v5</code> | PostgreSQL driver | | <code>github.com/ThreeDotsLabs/watermill</code> | Event bus (NATS, Kafka, HTTP) | | <code>github.com/spf13/cobra</code> | CLI framework | | <code>go.uber.org/fx</code> | Dependency injection | | <code>go.opentelemetry.io/otel</code> | Observability | | <code>github.com/antlr/antlr4</code> | ANTLR parser runtime (Numscript grammar) |</p>
<h2>Troubleshooting</h2>
<p>| Issue | Cause | Solution | |-------|-------|----------| | Connection refused on 3068 | Server not running | <code>docker compose up -d</code> or <code>go run main.go serve</code> | | Schema not found | Ledger not created or not upgraded | Set <code>AUTO_UPGRADE=true</code> or run <code>ledger buckets upgrade</code> | | Insufficient funds | Source account balance too low | Use <code>@world</code> as source or fund the account first | | Invalid posting | Negative amount or invalid account address | Amounts must be &gt;= 0, addresses match <code>^[a-zA-Z0-9_:]+$</code> | | Duplicate reference | Transaction reference already used | Use a unique <code>reference</code> field or omit it | | Numscript parse error | Invalid Numscript syntax | Check DSL syntax, ensure assets use <code>ASSET/precision</code> format |</p>
<h2>Related Skills</h2>
<ul><li><code>hanzo/hanzo-vault.md</code> - Card tokenization (PCI-compliant, used alongside ledger for payment flows)</li><li><code>hanzo/hanzo-commerce-api.md</code> - Commerce API (uses ledger for order accounting)</li><li><code>hanzo/hanzo-commerce.md</code> - Commerce storefront (drives transactions into ledger)</li><li><code>hanzo/hanzo-database.md</code> - PostgreSQL infrastructure (ledger&#x27;s storage backend)</li></ul>
<hr>
<p><strong>Last Updated</strong>: 2026-03-13 <strong>Category</strong>: Hanzo Ecosystem <strong>Related</strong>: ledger, accounting, double-entry, numscript, financial, transactions, go <strong>Prerequisites</strong>: Double-entry accounting concepts, Go, PostgreSQL, Docker</p>
<footer>
<div class="fmap">
<div><b>Build</b>
<a href="https://hanzo.app">hanzo.app</a> app builder
<a href="https://hanzo.codes">hanzo.codes</a> code with an agent
<a href="https://hanzoskills.com">hanzoskills.com</a> what an agent reads</div>
<div><b>Run</b>
<a href="https://console.hanzo.ai">console.hanzo.ai</a> cloud console
<a href="https://api.hanzo.ai">api.hanzo.ai</a> the API</div>
<div><b>Account</b>
<a href="https://hanzo.id">hanzo.id</a> sign in
<a href="https://pay.hanzo.ai">pay.hanzo.ai</a> top up
<a href="https://billing.hanzo.ai">billing.hanzo.ai</a> invoices and usage</div>
<div><b>Company</b>
<a href="https://hanzo.ai">hanzo.ai</a> canonical
<a href="https://hanzo.ventures">hanzo.ventures</a> ventures</div>
</div>
<div class="fend"><a href="/hanzo-ledger.md">This page as plain text</a> · <a href="/llms.txt">Index for agents</a></div>
</footer>
</div></body></html>