Hanzo ZT

Overview

Hanzo ZT architecture, concepts, design principles, and SDK comparison

Overview

Hanzo ZT is a zero-trust overlay networking SDK suite that provides secure, authenticated, and metered connections between services. It combines ZeroTier-style overlay networking with ZAP (Cap'n Proto RPC) transport for high-performance AI service communication.

Design Principles

  1. Zero Trust — Never trust the network. Every connection is authenticated and encrypted with x509 mTLS certificates issued by a central controller.
  2. No Open Ports — NAT traversal is built into the fabric. Services never expose ports to the public internet. All connectivity flows through encrypted tunnels with UDP hole punching.
  3. Billing-First — Usage metering and balance checks are enforced at the transport layer, not the application layer. No free tier — every dial() requires a positive balance.
  4. Language Parity — All 6 SDKs (Rust, Go, TypeScript, Python, C++, C) provide the same API surface and behavior guarantees.
  5. ZAP Native — Cap'n Proto RPC is a first-class citizen via the ZAP transport trait, enabling zero-copy binary serialization over the ZT fabric.

Components

ComponentDescription
ZT ControllerManages networks, identities, x509 certificates, and access policies. REST API at /edge/client/v1.
ZT FabricThe overlay network that connects nodes via mTLS tunnels with automatic NAT traversal.
ZAP ClientCap'n Proto RPC client that runs over the ZT transport using 4-byte BE length-prefix framing.
Hanzo IAMJWT-based authentication via hanzo.id. External JWT auth method for the controller.
Billing EngineBalance checks before dial and usage recording after session via the Hanzo Commerce API.

How It Works

1. Authenticate   →  Present JWT to ZT Controller
2. Get Identity   →  Controller issues x509 mTLS certificate
3. Check Balance  →  Verify positive balance via Commerce API
4. Dial Service   →  Establish mTLS tunnel through ZT fabric
5. Transfer Data  →  Send/receive through encrypted channel
6. Record Usage   →  Post usage metrics to Commerce API

SDK Comparison

All SDKs follow the same pattern but with language-idiomatic APIs:

FeatureRustGoTypeScriptPythonC++C
Async I/OTokiogoroutinesasync/awaitasynciostd::futurecallbacks
ZAP TransportTrait implInterfaceClassClassRAII classFunctions
ConfigBuilder patternBuilder patternInterfaceDataclassBuilderStruct
Error handlingResult/thiserrorerror valuesError classesExceptionsExceptionsReturn codes
Credential resolutionenv then fileenv then fileenv then fileenv then fileenv then fileenv then file
Tests9 pass5 passComplete11 passBuilds cleanSyntax pass

When to Use Hanzo ZT

Use ZT when you need:

  • Service-to-service communication without exposing ports
  • mTLS encryption for all traffic regardless of network
  • Centralized identity and access management
  • Transport-level billing and usage metering
  • Cross-language RPC via ZAP/Cap'n Proto
  • NAT traversal for services behind firewalls

Don't use ZT when:

  • Public HTTP APIs with standard TLS suffice
  • You're building a public-facing web application
  • Low-latency requirements preclude overlay networking overhead

Relationship to ZAP

ZAP (Zero-copy Application Protocol) provides the RPC layer, while ZT provides the networking layer:

ZAPZT
PurposeRPC protocolOverlay networking
SerializationCap'n ProtoN/A (transport)
EncryptionOptionalAlways (mTLS)
AuthenticationApp-levelTransport-level
URL schemetcp://, ws://zt://

When combined, ZAP over ZT gives you zero-copy RPC with zero-trust networking — the best of both worlds.

Next Steps

On this page