VoltaireAPI interface, ensuring compile-time errors if APIs diverge.
Three Entrypoints
| Entrypoint | Import | Runtime | Use Case |
|---|---|---|---|
| JS | @tevm/voltaire | Any JS runtime | Default, universal compatibility |
| WASM | @tevm/voltaire/wasm | Browser, Node, Bun, Deno | High performance, portable |
| Native | @tevm/voltaire/native | Bun | Maximum performance via FFI |
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
| Operation | JS | WASM | Native | Default |
|---|---|---|---|---|
| keccak256 | 1x | ~5x | ~10x | JS |
| secp256k1 sign | 1x | ~8x | ~15x | JS |
| secp256k1 recover | 1x | ~8x | ~15x | JS |
| RLP encode | 1x | ~1.2x | ~1.5x | JS |
| Hex encode | 1x | ~1.1x | ~1.2x | JS |
WASM Limitations
| Module | WASM Status | Reason | Alternative |
|---|---|---|---|
| BIP-39 / HD Wallet | ❌ Not available | Requires libwally-core (C library) | Use native or JS entrypoint |

