Works everywhere. TypeScript, Zig, any language with C-FFI.
TypeScript Entrypoints
Voltaire provides three entrypoints with identical APIs for different performance profiles:
import { Address , Keccak256 } from '@tevm/voltaire' // JS (default)
import { Address , Keccak256 } from '@tevm/voltaire/wasm' // WASM
import { Address , Keccak256 } from '@tevm/voltaire/native' // Native FFI (Bun only)
All entrypoints implement the same VoltaireAPI interface - switch by changing the import path.
Installation by Language
TypeScript/JavaScript
Zig
C-FFI
npm install @tevm/voltaire
# or: bun add @tevm/voltaire / pnpm add @tevm/voltaire / yarn add @tevm/voltaire
Then import from any entrypoint: // JS (default) - works everywhere
import { Address , Keccak256 } from '@tevm/voltaire'
// WASM - for browser/edge crypto performance
import { Address , Keccak256 } from '@tevm/voltaire/wasm'
// Native - for Bun maximum performance
import { Address , Keccak256 } from '@tevm/voltaire/native'
Important: Voltaire requires native C/Rust libraries that must be built before use. zig fetch alone will not work because the Rust crypto wrappers (libcrypto_wrappers.a) are built at compile time via Cargo.
Option 1: Git Submodule (Recommended) Add as a git submodule in your project: git submodule add https://github.com/evmts/voltaire.git lib/voltaire
cd lib/voltaire
zig build # Builds Rust/C dependencies via Cargo
Then in your build.zig: const voltaire = b . dependency ( "voltaire" , .{
. target = target ,
. optimize = optimize ,
});
// Add modules to your executable/library
exe . root_module . addImport ( "primitives" , voltaire . module ( "primitives" ));
exe . root_module . addImport ( "crypto" , voltaire . module ( "crypto" ));
// Link required native libraries
exe . linkLibrary ( voltaire . artifact ( "blst" ));
exe . linkLibrary ( voltaire . artifact ( "c_kzg" ));
And in your build.zig.zon: . dependencies = .{
. voltaire = .{ . path = "lib/voltaire" },
},
Option 2: Build from Source Clone and build once, then reference by path: git clone https://github.com/evmts/voltaire.git
cd voltaire
zig build # Requires Cargo/Rust installed
Prerequisites for Zig builds: Build the C library: git clone https://github.com/evmts/voltaire.git
cd voltaire
zig build -Dwith-c-api=true
This produces:
zig-out/lib/libprimitives_c.a (static library)
zig-out/lib/libprimitives_c.dylib (dynamic library, macOS)
zig-out/include/primitives.h (C header)
Link against the library and include the header in your project.
First Class Support TypeScript, Zig, and C - fully supported with complete APIs and documentation
C-FFI Support Swift, Go, Python, Kotlin, and any language with foreign function interface support
C-FFI bindings require manual memory management. Always call corresponding _free functions to prevent leaks.
Consistent API
The Voltaire API is consistent across all languages.
TypeScript
Zig
C
Swift
Kotlin (Experimental)
Go (Experimental)
Python (Experimental)
import { Address } from '@tevm/voltaire'
const address = Address ( '0x742d35Cc6634C0532925a3b844Bc9e7595f51e3e' )
Address . toChecksummed ( address )
Address . toHex ( address )
Address . isZero ( address )
Address . equals ( address , otherAddress )
// Also available as instance methods
address . toChecksummed ()
address . toHex ()
address . isZero ()
address . equals ( otherAddress )
const Address = @import ( "primitives" ). Address ;
pub fn main () ! void {
const address = try Address . fromHex ( "0x742d35Cc6634C0532925a3b844Bc9e7595f51e3e" );
_ = address . toChecksummed ();
_ = address . toHex ();
_ = address . isZero ();
_ = address . equals ( otherAddress );
}
#include "primitives.h"
int main () {
Address * address = tevm_address_from_hex ( "0x742d35Cc6634C0532925a3b844Bc9e7595f51e3e" );
char * checksummed = tevm_address_to_checksummed (address);
char * hex = tevm_address_to_hex (address);
bool is_zero = tevm_address_is_zero (address);
bool equal = tevm_address_equals (address, other_address);
// Free memory
tevm_string_free (checksummed);
tevm_string_free (hex);
tevm_address_free (address);
}
import Voltaire
// Idiomatic Swift wrappers over C-FFI
let address = try Address ( hex : "0x742d35Cc6634C0532925a3b844Bc9e7595f51e3e" )
print (address. checksumHex )
print (address. hex )
print (address. isZero )
let other = try Address ( hex : "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" )
print (address == other)
import com.tevm.voltaire.Address
// JNI bindings over C-FFI
val address = Address. fromHex ( "0x742d35Cc6634C0532925a3b844Bc9e7595f51e3e" )
println (address.checksumHex)
println (address.hex)
println (address.isZero)
val other = Address. fromHex ( "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" )
println (address == other)
package main
import " github.com/evmts/voltaire-go "
func main () {
address , _ := voltaire . AddressFromHex ( "0x742d35Cc6634C0532925a3b844Bc9e7595f51e3e" )
fmt . Println ( address . ChecksumHex ())
fmt . Println ( address . Hex ())
fmt . Println ( address . IsZero ())
other , _ := voltaire . AddressFromHex ( "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" )
fmt . Println ( address . Equals ( other ))
}
from voltaire import Address
# ctypes/cffi bindings over C-FFI
address = Address.from_hex( "0x742d35Cc6634C0532925a3b844Bc9e7595f51e3e" )
print (address.checksum_hex)
print (address.hex)
print (address.is_zero)
other = Address.from_hex( "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" )
print (address == other)
Looking for Help
We’re looking for contributors to help build idiomatic wrappers for:
Go - Native bindings via cgo
Python - Bindings via ctypes/cffi
Swift - Fully implemented but lacking tests and complete documentation
Kotlin - Android/JVM bindings