Hanzo Treasury is a programmable financial infrastructure stack providing a double-entry ledger, payment connectors, virtual wallets, reconciliation, and workflow orchestration.
Category: Hanzo Ecosystem Related Skills: hanzo/hanzo-payments.md, hanzo/hanzo-commerce.md, hanzo/hanzo-ledger.md
Hanzo Treasury is a programmable financial infrastructure stack providing a double-entry ledger, payment connectors, virtual wallets, reconciliation, and workflow orchestration. Go monorepo (forked from Formance Stack). Uses Earthly for builds. License: MIT.
github.com/formancehq/stack, Go 1.22)gojsonschema)Repo: hanzoai/treasury (Formance Stack fork). Default branch: main.
| Item | Value | |------|-------| | Ledger API | POST /v2/ledger/{name}/transactions | | Accounts API | GET /v2/ledger/{name}/accounts | | Payments API | POST /v2/payments | | Wallets API | POST /v2/wallets | | Reconciliation API | POST /v2/reconciliation/policies | | Local Port | 3068 (ledger) | | License | MIT | | Repo | github.com/hanzoai/treasury |
docker compose up -d
curl -X POST http://localhost:3068/v2/ledger/demo/transactions \
-H "Content-Type: application/json" \
-d '{
"postings": [{
"source": "world",
"destination": "users:001",
"amount": 10000,
"asset": "USD/2"
}]
}'
// Transfer with 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
}
}
)
hanzo/commerce Storefront, catalog, orders
|
hanzo/payments Payment routing (50+ processors)
|
hanzo/treasury Ledger, reconciliation, wallets, flows <-- this repo
|
lux/treasury On-chain treasury, MPC/KMS wallets
| Component | Description | |-----------|-------------| | Ledger | Programmable double-entry, immutable source of truth | | Payments | Unified API and data layer for payment processing | | Numscript | DSL for modeling monetary computations and flows | | Wallets | Multi-currency virtual wallets with hold/release | | Reconciliation | Auto-match ledger vs. payment provider data | | Flows | Workflow orchestration (via orchestration service) | | Webhooks | Event delivery for financial state changes | | Auth | Authentication and authorization for treasury APIs | | Search | Full-text search across treasury data | | Gateway | API gateway for all treasury services |
| Service | Version | |---------|---------| | Ledger | v2.3.1 | | Payments | v3.0.18 | | Wallets | v2.1.5 | | Webhooks | v2.2.0 | | Auth | v2.4.0 | | Search | v2.1.0 | | Orchestration | v2.4.0 | | Reconciliation | v2.2.1 | | Gateway | v2.1.0 |
Events are JSON Schema-validated. The events/ directory contains:
base.yaml - Common event envelope (type, app, payload)services/ledger/ - Ledger events (e.g., SAVED_TRANSACTION)services/payments/ - Payment events (e.g., SAVED_PAYMENT)services/orchestration/ - Workflow eventsEvent validation in Go:
import "github.com/formancehq/stack/events"
err := events.Check(data, "payments", "SAVED_PAYMENT")
The releases/ directory merges OpenAPI specs from all sub-services into a unified API spec:
/api/auth/*/api/ledger/*/api/payments/*/api/wallets/*/api/webhooks/*/api/search/*/api/orchestration/*/api/reconciliation/*Authentication: OAuth2 client credentials (/api/auth/oauth/token).
treasury/
README.md # Project overview
LLM.md # AI agent documentation
LICENSE # MIT
go.mod # Root Go module (github.com/formancehq/stack)
Earthfile # Earthly build (downloads + merges OpenAPI specs)
base.Dockerfile # Base Docker image
events/
base.yaml # Common event envelope schema
events.go # Go event validation library
services/
ledger/ # Ledger event schemas
payments/ # Payment event schemas
orchestration/ # Orchestration event schemas
generated/ # Auto-generated event code
libs/
events/
generated/ # Generated event library
releases/
base.yaml # OpenAPI 3.0.3 base spec
openapi-merge.json # Config for merging all service specs
openapi-overlay.json # Spec overlays
# Build all (OpenAPI spec + events)
earthly +build
# Build just the merged OpenAPI spec
earthly +build-final-spec
# Go tests
go test ./...
| Issue | Cause | Solution | |-------|-------|----------| | Earthly build fails | Missing Earthly CLI | Install with brew install earthly | | Event validation fails | Schema version mismatch | Check events/services/ for latest version dir | | API 401 | Missing OAuth token | Get token from /api/auth/oauth/token | | Ledger balance error | Insufficient funds in source | Check account balances via GET /v2/ledger/{name}/accounts |
hanzo/hanzo-payments.md - Payment routinghanzo/hanzo-commerce.md - E-commerce platformhanzo/hanzo-ledger.md - Ledger detailshanzo/hanzo-kms.md - Secret managementhanzo/hanzo-sql.md - PostgreSQL backendLast Updated: 2026-03-13 Category: Hanzo Ecosystem Related: treasury, ledger, payments, wallets, reconciliation, numscript, fintech Prerequisites: Go 1.22+, Earthly, Docker, PostgreSQL