Skip to main content

Multi-Language Integration

Voltaire combines four languages, each chosen for specific strengths.

Language Roles

Architecture

Zig-to-TypeScript (Primary Path)

Native FFI (Bun)

Bun’s FFI provides near-native performance:

WASM (Browser/Node)

For non-Bun environments:

Exporting from Zig

Zig-to-Rust

Rust is used for complex elliptic curve operations via arkworks.

Cargo Configuration

Rust FFI Functions

Zig Bindings

Zig-to-C

C libraries are used for mature, audited implementations.

Vendored Libraries

Build Integration

Zig C Imports

C Header Generation

Auto-generate C headers from Zig:
Output: src/primitives.h

Cross-Language Testing

Zig Tests with C

TypeScript Tests with Native

Fuzzing Across Languages

Error Handling Across Languages

Zig Errors

C Return Codes

Rust Result Types

TypeScript Error Translation

Build Dependencies

Full Build Chain

Dependency Graph