VoltaireAPI interface, ensuring compile-time errors if APIs diverge.
Three Entrypoints
All three entrypoints export identical namespaces and types. Switch implementations by changing the import path - no code changes required.
JS (Default)
Pure TypeScript/JavaScript. Works everywhere JavaScript runs.Shares the ox peer dependency for amortized bundle costs.
WASM
WebAssembly bindings to Zig implementations. Portable high-performance.The WASM entrypoint exports the same API as JS. Switch by changing the import path.
Design trade-off: Voltaire’s published WASM builds target a balance of strong performance and small bundle size. If you need maximum raw speed for specific workloads, build from source using the performance-optimized target (ReleaseFast). See
/dev/build-system#typescript-targets and /dev/wasm#build-modes.Native FFI (Bun)
Direct bindings to Zig via Bun FFI. Maximum performance.The Native entrypoint exports the same API as JS. Switch by changing the import path.
Per-Module Imports
For fine-grained control, import specific implementations:Performance Considerations
Bridging overhead: Crossing the JS↔WASM or JS↔FFI boundary has constant overhead (~1-10μs). For cheap operations (simple math, short string manipulation), this overhead can exceed the operation itself. When WASM/Native wins:- Cryptographic operations (keccak256, secp256k1, BLS) - 5-15x faster
- Large data encoding/decoding (RLP, ABI with big payloads)
- Batch operations that amortize bridging cost
- Simple operations (hex encoding small values, address validation)
- String/hex formatting helpers that map to JS built-ins (for example,
toHex()) - Very small, trivial conversions where JS↔WASM overhead dominates
- Single-item operations with low computational cost
- When avoiding async overhead matters
WASM Limitations
All other modules including BLS12-381, KZG, and BN254 work in WASM.

