Skip to main content
Voltaire is a modern general-purpose Ethereum library for TypeScript, Zig, C, and Swift. Type-safe primitives, WASM-accelerated performance, and designed for AI-assisted development.
Want to explore Voltaire in your browser? Open the Playground.

Simple, Intuitive API

Voltaire’s API mirrors Ethereum specifications:
import { Address, Wei, Gwei, Ether } from '@tevm/voltaire';
import { Hex } from '@tevm/voltaire/Hex';
import { Bytes32 } from '@tevm/voltaire/Bytes32';
import { Rlp } from '@tevm/voltaire/Rlp';
import { Abi } from '@tevm/voltaire/Abi';
import { Keccak256 } from '@tevm/voltaire/Keccak256';

// Addresses - branded Uint8Array with type safety
const addr = Address('0x742d35Cc6634C0532925a3b844Bc9e7595f51e3e');
console.log(addr.toHex());        // "0x742d35cc..."
console.log(addr.toChecksummed()); // "0x742d35Cc..."

// Denominations - type-safe ETH value handling
const value = Wei(1000000000000000000n);
console.log(Wei.toEther(value));  // "1"
console.log(Wei.toGwei(value));   // "1000000000"

// Type safety prevents denomination confusion
// ❌ This won't compile - Wei and Gwei are incompatible types
// const confusion: WeiType = someGweiValue; // Type Error!

// Fixed-size bytes
const hash = Bytes32('0x' + '12'.repeat(32));
console.log(hash.toHex());

// Keccak256 hashing
const messageHash = Keccak256('hello');
const selector = Keccak256.selector('transfer(address,uint256)');
// Uint8Array(4) [0xa9, 0x05, 0x9c, 0xbb]

// RLP encoding
const encoded = Rlp.encode([addr, Hex.fromNumber(42n)]);
const decoded = Rlp.decode(encoded);

// ABI encoding
const transferAbi = {
  type: 'function',
  name: 'transfer',
  inputs: [
    { type: 'address', name: 'to' },
    { type: 'uint256', name: 'amount' }
  ],
  outputs: [{ type: 'bool' }],
  stateMutability: 'nonpayable'
} as const;

const calldata = Abi.Function.encodeParams(transferAbi, [
  '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
  1000000000000000000n
]);

What’s Included

Highly Customizable JSON-RPC Provider

Type-Safe and Feature-Full Ethereum Primitives

High Performance Cryptography

Advanced Bytecode and EVM Capabilities

ENS (Ethereum Name Service)

Sign-in with Ethereum

What’s Unique?

  • Branded Types - Runtime-validated TypeScript types. Prevents passing hex strings where addresses are expected, address casing errors, and type confusion.
  • High-Performance - Optimized implementations balancing performance and bundle size. For example, Keccak256 is both faster and smaller than pure JavaScript alternatives.
  • LLM-Optimized - API mirrors the Ethereum specification. Lots of time has been put into polishing the MCP server and llms.txt along with the docs themselves.
  • Multiplatform - Works everywhere: TypeScript in Node.js, browsers, serverless, and any language with C-FFI support. Consistent API across TypeScript, Zig, and C-FFI environments.
    Native FFI is currently supported on Bun. In Node.js, use the regular TypeScript API or WASM.
  • Skills - Higher-level abstractions as copyable implementations, not rigid library exports. Like shadcn/ui for Ethereum—copy a provider, contract wrapper, or React integration into your codebase and customize it for your needs.