Skip to content
evmtsPublic

About

Ethereum primitives and cryptography

Resources

Code of conduct

Contributing

Stars

69 stars

Watchers

0 watching

Forks

Latest commit

 

History

232 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Voltaire

Type-safe Ethereum primitives, cryptography, and EVM execution — written in Zig and TypeScript, with a C ABI for any language.

npm version Zig 0.17.1 CI status MIT License

Docs · Live Playground · Benchmarks · Spec Compliance · Smithers Factory · Engineering Wiki · C FFI Recipes

Architecture

Voltaire implements Ethereum primitives, cryptography, and EVM execution once in Zig 0.17.1 (with blst, c-kzg-4844, and arkworks), then compiles to WebAssembly and exports a stable C99 ABI (primitives.h / libprimitives_c) consumed by TypeScript, Bun Native FFI, and any language with a C FFI.

Layer Source / Output Consumers
Core packages/voltaire-zig (Zig 0.17.1 + blst / c-kzg-4844 / arkworks) Native Zig packages (@tevm/zig), ZEVM
WebAssembly primitives.wasm + per-module crypto/*.wasm @tevm/voltaire/wasm (Browser, Node, Bun, Deno)
C99 ABI zig-out/include/primitives.h + libprimitives_c.{so,dylib,a} @tevm/voltaire/native (Bun FFI) and C / C++ / Rust / Go / Python / Swift

Published Packages

Package Directory Description
@tevm/voltaire packages/voltaire-ts Branded TypeScript primitives, cryptography, and EVM; Pure TS, WASM, and Bun Native FFI entrypoints
@tevm/zig packages/voltaire-zig Core Zig 0.17 primitives, cryptography, precompiles, WASM reactor binaries, and C ABI

Quick Start (TypeScript)

pnpm add @tevm/voltaire
import { Address, Wei } from '@tevm/voltaire';
import { Abi } from '@tevm/voltaire/Abi';
import { Keccak256 } from '@tevm/voltaire/Keccak256';

// Branded 20-byte Uint8Array — validated once at construction
const to = Address('0xd8da6bf26964af9d7eed9e03e53415d37aa96045');
Address.toChecksummed(to); // "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"

// Compile-time denomination safety (Wei ≠ Gwei ≠ Ether)
const amount = Wei(1_000_000_000_000_000_000n);
Wei.toEther(amount); // "1"

// Selectors and ABI encoding
const selector = Keccak256.selector('transfer(address,uint256)');
const erc20 = Abi([
  {
    type: 'function',
    name: 'transfer',
    stateMutability: 'nonpayable',
    inputs: [
      { type: 'address', name: 'to' },
      { type: 'uint256', name: 'amount' },
    ],
    outputs: [{ type: 'bool' }],
  },
] as const);

const calldata = erc20.encode('transfer', [to.toHex(), amount]);

Swap backends with a single synchronous import change (no await boilerplate in Node/Bun; call await initWasm() once in browsers):

import { Keccak256, Secp256k1 } from '@tevm/voltaire/wasm';   // Zig WASM (337 kB raw / 117 kB gz; 3.1 kB keccak256.wasm)
import { Keccak256, Secp256k1 } from '@tevm/voltaire/native'; // Sync Zig Native FFI (13 crypto modules)

Quick Start (Zig 0.17.1 — Zero Rust Required)

zig fetch --save git+https://github.com/evmts/voltaire

The Zig core compiles out of the box with only Zig 0.17.1 (pure-Zig BN254 + blst + c-kzg-4844 + ARMv8.2/portable Keccak). Optional Rust arkworks / keccak-asm wrappers remain available via -Dwith-rust=true.

C FFI Recipes (C, C++, Rust, Go, Python, Swift)

Download a prebuilt release tarball (libprimitives_c, primitives.h, voltaire.pc) from GitHub Releases or build from source:

git submodule update --init --recursive packages/voltaire-zig/lib/libwally-core
zig build -Dwith-c-api=true -Doptimize=ReleaseFast
# Produces zig-out/include/primitives.h and zig-out/lib/libprimitives_c.{so,dylib,a}

See docs/C_FFI_RECIPES.md for copy-paste build, linking, pkg-config, and binding recipes in C/C++, Rust, Go (CGO), Python (ctypes), and Swift (SwiftPM).

AI Agent Integration

Connect the hosted MCP server, Context7 docs index (context7.json), or Voltaire skills:

# Claude Code MCP
claude mcp add --transport http voltaire https://voltaire.tevm.sh/mcp

# Claude Code / Codex Skills
git clone https://github.com/evmts/skills ~/.claude/skills/voltaire-skills

Machine-readable indexes: voltaire.tevm.sh/llms.txt · voltaire.tevm.sh/llms-full.txt.

Dependencies

  • TypeScript: @noble/curves, @noble/hashes, @noble/ciphers, @scure/bip32, @scure/bip39, @adraffy/ens-normalize, abitype (optional peer) — zero ox, zero @tevm/chains, zero UI deps
  • Native / WASM (default, zero Rust): blst, c-kzg-4844 (plus optional -Dwith-rust=true for ark-bn254 / ark-bls12-381 / keccak-asm)

Links

MIT License — see LICENSE.

About

Ethereum primitives and cryptography

Resources

Code of conduct

Contributing

Stars

69 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages