Price a heterogeneous, SLA-bound compute job via the Hamiltonian Market Maker,
NOT a constant-product (x*y=k) AMM. Compute is perishable/heterogeneous/SLA-
bound; an AMM prices a fungible storable pair and cannot express scarcity
convexity, deadline pressure, or per-resource isolation.
compute_price::price(job, market) -> HanzoPrice (wei, 18 decimals):
- maps market imbalance (demand vs supply) into the Hamiltonian phase space
(position = tanh(imbalance) shadow-price displacement; momentum = elasticity *
displacement) under an ANHARMONIC potential (quartic term => super-linear
scarcity bite that a quadratic / x*y=k cannot express);
- evolves the existing symplectic leapfrog integrator with friction to the
energy-modulated equilibrium and reads HamiltonianDynamics::calculate_price
(price modulated by total energy E = T + V; scarcity raises E raises price);
- modulates by SLA tightness (tighter deadline => higher price, perishability)
and quality/privacy tier, then clamps to [1e13, 1e16] wei (AI_TOKEN_ECONOMICS
min/max). Deterministic (noise-free path, no rng) => reproducible + testable.
Pure ADAPTER over crate::hamiltonian — re-implements no mechanics (DRY). The
broker calls this to set the on-chain escrow amount; ComputeSettlement then
settles that amount against a canonical PoAI proof (LP-302).
Tests (8 named properties + tier + bad-input): monotone in scarcity, monotone
in demand, SLA perishability, bounded, heterogeneity (resources price
independently), determinism, tier ordering, explicit input rejection. Found +
fixed a real bug: raw-imbalance seeding diverged the stiff quartic to NaN at
extreme scarcity; normalized tanh seeding keeps the integrator in its stable
basin while a strictly-increasing scarcity factor preserves monotonicity.
cargo test -p hanzo-hmm: 25/25 (8 new + 17 pre-existing, no regression).
hamiltonian.rs: add set_phase_space(PhaseSpace) (dimension-checked) so (q,p) can
be seeded deterministically without the stochastic perturb path. No behavior
change to existing API; all prior tests still pass.
Refs LP-302 (settlement), zip-0418 / AI_TOKEN_ECONOMICS (HMM).
Co-authored-by: zeekay <z@zeekay.io>
User mandate: "if valid fix and publish, if worthless delete — one and one way only".
Deleted (no consumers, broken / incomplete / aspirational):
- hanzo-baml — git-only baml-runtime dep; BAML integration never wired
- hanzo-db — unused alongside hanzo-database/hanzo-db-sqlite
- hanzo-kbs — incomplete, missing types, no in-tree consumer
- hanzo-sheet — abandoned spreadsheet UI, depends on non-existent module
- hanzo-simulation — research stub, not used by node
- hanzo-sovereign — 170-LoC sketch with broken ml-dsa = "0.6" (no stable release)
- hanzo-tests — test-only crate with compile errors
Fixed and unblocked:
- hanzo-vm — uses crates.io luxprecompile-sys 0.1, hanzo-engine 0.6
- hanzo-consensus — uses crates.io lux-consensus 1.22
- hanzo-l2 — uses crates.io lux-consensus 1.22
Removed `publish = false` from the three so they can ship to crates.io.
Cargo.lock will regenerate on next build.
The rust-sdk workspace (hanzoai/rust-sdk) just published these crate names at
1.1.21 with different implementations. To preserve clean namespaces:
- crates.io name: hanzonet-pqc / hanzonet-did / hanzonet-config / hanzonet-mcp
- Rust lib name: hanzo_pqc / hanzo_did / hanzo_config / hanzo_mcp (unchanged)
This is achieved via `[lib] name = "hanzo_<x>"` on the renamed packages and
`package = "hanzonet-<x>"` in workspace.dependencies — consumers keep using
`hanzo-<x>.workspace = true` and `use hanzo_<x>::...` with zero code churn.
Also: bumped patch versions on all members per crates.io state, pinned every
path-dep in workspace.dependencies with a `version = ` so the workspace can
publish to crates.io. workspace.package.version → 1.1.21.
Effect: 32 net crates become publishable in topo order; hanzo-vm,
hanzo-consensus, hanzo-l2 remain `publish = false` because they path-depend
on cross-repo lux crates (luxprecompile-sys, lux-consensus) that aren't on
crates.io.
This repo holds the network-layer Rust crates previously living under
github.com/hanzoai/node:hanzo-libs/. Breaking them out gives each crate
its own version + publish cadence and lets downstream consumers depend on
them without pulling the whole node tree.
Highlights:
- hanzo-hmm — Hidden Markov Model primitives + Hamiltonian MarketMaker
for pricing heterogeneous compute. 17 lib tests pass. Earlier was named
hanzo-llm (misleading) and the standalone hmm stub; both merged here
with HLLM* identifier prefixes scrubbed.
- hanzo-vm — Hanzo EVM with precompiles wired to canonical
libluxprecompile.dylib (PQ verify, Quasar) and hanzo-engine
(AI inference, embedding). 37 lib tests pass (DYLD_LIBRARY_PATH=
/Users/z/work/lux/precompile/dist).
- hanzo-machine — VM lifecycle (Apple Virtualization.framework via vfkit
on macOS; KVM on Linux), thin Rust wrapper over canonical C++ impl
in github.com/luxfi/luxcpp/machine.
- hanzo-pqc / hanzo-did / hanzo-identity / hanzo-libp2p* — crypto +
identity + networking primitives.
- hanzo-l2 / hanzo-consensus / hanzo-mining — chain layer.
- hanzo-api / hanzo-http-api / hanzo-mcp / hanzo-tools / hanzo-tools-runner
— service + tooling crates.
Build: `cargo build --workspace` succeeds in ~25min cold (44 crates).