ZAP Protocol
Native
ZAP (Zero-Copy App Proto) is a high-performance binary RPC protocol based on Cap'n Proto.Lux Cloud implements native ZAP - direct Cap'n Proto RPC over TCP for AI agents.
Connect
Connect directly to the native ZAP server:
zap://api.cloud.lux.network:9999Schema
ZAP uses a clean, whitespace-significant syntax. No ordinals, no braces, no semicolons. Field order determines wire encoding.
# Structs - field order determines ordinals
struct User
name Text
email Text
age UInt32
# Adding fields is always backwards-compatible
struct User
name Text
email Text
age UInt32
phone Text # New field - safe to add
verified Bool # New field - safe to add
# Nested structs
struct Metadata
entries List(Entry)
struct Entry
key Text
value Text
# Enums - value order determines encoding
enum Status
pending
active
completed
# Unions
struct Content
union data
text Text
blob Data
json Text
# Interfaces with methods
interface Bootnode
init (client ClientInfo) -> (server ServerInfo)
listTools () -> (tools ToolList)
callTool (call ToolCall) -> (result ToolResult)
rpcCall (request RPCRequest) -> (response RPCResponse)Python Client
from hanzo_zap import Client
async with Client.connect("zap://api.cloud.lux.network:9999") as client:
# Initialize connection
server_info = await client.init({
"name": "my-agent",
"version": "1.0.0"
})
print(f"Connected to {server_info.name} v{server_info.version}")
# List available tools
tools = await client.list_tools()
for tool in tools:
print(f" - {tool.name}: {tool.description}")
# Call a tool
result = await client.call_tool("rpc_call", {
"chain": "ethereum",
"method": "eth_blockNumber"
})
print(f"Block: {int(result['result'], 16)}")Rust Client
use hanzo_zap::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::connect("zap://api.cloud.lux.network:9999").await?;
// Initialize
let server = client.init("my-agent", "1.0.0").await?;
println!("Connected to {} v{}", server.name, server.version);
// List tools
let tools = client.list_tools().await?;
for tool in tools {
println!(" - {}: {}", tool.name, tool.description);
}
// Call tool
let result = client.call_tool("rpc_call", serde_json::json!({
"chain": "ethereum",
"method": "eth_blockNumber"
})).await?;
println!("Result: {:?}", result);
Ok(())
}Go Client
package main
import (
"context"
"fmt"
"log"
"github.com/hanzo-ai/zap-go"
)
func main() {
ctx := context.Background()
client, err := zap.Connect(ctx, "zap://api.cloud.lux.network:9999")
if err != nil {
log.Fatal(err)
}
defer client.Close()
// Initialize
server, err := client.Init(ctx, "my-agent", "1.0.0")
if err != nil {
log.Fatal(err)
}
fmt.Printf("Connected to %s v%s\n", server.Name, server.Version)
// List tools
tools, err := client.ListTools(ctx)
if err != nil {
log.Fatal(err)
}
for _, tool := range tools {
fmt.Printf(" - %s: %s\n", tool.Name, tool.Description)
}
// Call tool
result, err := client.CallTool(ctx, "rpc_call", map[string]any{
"chain": "ethereum",
"method": "eth_blockNumber",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("Result: %v\n", result)
}Available Tools
| Tool | Description |
|---|---|
| rpc_call | Execute JSON-RPC on any supported blockchain |
| get_token_balances | Get ERC-20 token balances for an address |
| get_token_metadata | Get token metadata (name, symbol, decimals) |
| get_nfts_owned | Get NFTs owned by an address |
| get_nft_metadata | Get NFT metadata and attributes |
| create_smart_wallet | Create ERC-4337 smart wallet |
| get_smart_wallet | Get smart wallet details |
| create_webhook | Create webhook for blockchain events |
| list_webhooks | List configured webhooks |
| delete_webhook | Delete webhook by ID |
| estimate_gas | Get current gas prices |
Available Resources
| URI | Description |
|---|---|
| bootnode://chains | List of all supported blockchain networks |
| bootnode://usage | API usage for current billing period |
| bootnode://config | Current API configuration and limits |
Code Generation
Download the schema and generate client code for your language:
# Download the .zap schema (new whitespace-significant format)
curl -H "X-API-Key: YOUR_API_KEY" \
https://api.bootno.de/v1/zap/schema > bootnode.zap
# Compile to Cap'n Proto
zapc compile bootnode.zap --out=bootnode.capnp
# Generate Python client
zapc generate bootnode.capnp --lang python --out ./gen/
# Generate Rust client
zapc generate bootnode.capnp --lang rust --out ./gen/
# Generate Go client
zapc generate bootnode.capnp --lang go --out ./gen/
# Generate TypeScript client
zapc generate bootnode.capnp --lang typescript --out ./gen/REST Discovery Endpoints
Use these REST endpoints for discovery and debugging:
GET
/v1/zap/connectConnection info & client examples
GET
/v1/zap/infoServer capabilities
GET
/v1/zap/toolsAvailable tools
GET
/v1/zap/resourcesAvailable resources
GET
/v1/zap/schema.zap schema (whitespace-significant)
GET
/v1/zap/schema.capnpCompiled .capnp schema
GET
/v1/zap/healthHealth check
MCP Compatibility
ZAP implements a superset of the Model Context Protocol (MCP). All MCP clients can connect to ZAP servers, and ZAP extends MCP with:
- Binary wire format (Cap'n Proto) for 10-100x faster serialization
- Zero-copy reads for large payloads
- Streaming responses for real-time data
- Native TCP transport (no HTTP overhead)
- Bidirectional communication