ZAP Protocol
Language Bindings

Language Bindings

ZAP SDK documentation for all supported languages

Language Bindings

ZAP provides native bindings for 11 programming languages. Each binding is built on the reference Cap'n Proto implementation for that language.

Supported Languages

Implementation Status

LanguageClientServerGatewayPQ-TLSConsensus
RustYesYesYesYesYes
GoYesYesYesYesYes
PythonYesYesYesPartialPlanned
JavaScriptYesPartialYesNoPlanned
C++YesYesYesYesPartial
CYesPartialNoNoNo
JavaYesYesPartialPartialPlanned
C#YesPartialNoNoNo
ErlangYesYesPartialNoPlanned
OCamlYesPartialNoNoNo
HaskellYesPartialNoNoNo

Common Patterns

Client Creation

All bindings follow a similar pattern:

// Rust
let client = Zap::connect("zap://localhost:9000").await?;
// Go
client, err := zap.Connect(ctx, "zap://localhost:9000")
# Python
client = await Zap.connect("zap://localhost:9000")
// JavaScript
const client = await Zap.connect('zap://localhost:9000');

Error Handling

Each binding uses idiomatic error handling:

  • Rust: Result<T, Error> with ? operator
  • Go: Multiple return values (result, error)
  • Python: Exceptions with async context
  • JavaScript: Promises with try/catch or .catch()

Async/Await

Most bindings support async operations:

// Rust (tokio)
let tools = client.list_tools().await?;
// Go (goroutines)
tools, err := client.ListTools(ctx)
# Python (asyncio)
tools = await client.list_tools()
// JavaScript (Promises)
const tools = await client.listTools();

Schema Code Generation

Generate bindings from the ZAP schema:

# Clone the schema
git clone https://github.com/zap-protocol/zap
cd zap/schema

# Generate for your language
capnp compile -o rust zap.capnp
capnp compile -o go zap.capnp
capnp compile -o c++ zap.capnp

See language-specific pages for detailed code generation instructions.

Contributing

Language bindings are maintained in separate repositories:

Contributions welcome! See each repo's CONTRIBUTING.md for guidelines.

Last updated on

On this page