Skip to main content
Looking to learn more about why to use Voltaire? Check out What is Voltaire?

Prerequisites

  • Zig: 0.15.1 or newer (matches .minimum_zig_version)
  • Tooling: git (optional), a C toolchain for some crypto backends
  • Knowledge: Basic Zig and Ethereum concepts
New to Ethereum? Check out our Guides for example-based content. No prior Ethereum knowledge required.

Installation

You can add Voltaire as a dependency via the Zig package manager. Then in your build.zig add the modules:
const voltaire = b.dependency("voltaire", .{});
exe.root_module.addImport("primitives", voltaire.module("primitives"));
exe.root_module.addImport("crypto", voltaire.module("crypto"));

Imports

const primitives = @import("primitives");

const Address = primitives.Address;
const Hex = primitives.Hex;
const Rlp = primitives.Rlp;
const Uint = primitives.Uint;
const Transaction = primitives.Transaction;
const Opcode = primitives.Opcode;
const GasConstants = primitives.GasConstants;

// Example
const addr = try Address.fromHex("0xa0cf798816d4b9b9866b5330eea46a18382f251e");

Verify Installation

const std = @import("std");
const primitives = @import("primitives");
const crypto = @import("crypto");

pub fn main() !void {
    const addr = try primitives.Address.fromHex("0x742d35Cc6634C0532925a3b844Bc9e7595f51e3e");
    const hash = crypto.keccak256.hash("hello");
    std.debug.print("{s} {s}\n", .{ addr.toHex(), std.fmt.fmtSliceHexLower(&hash) });
}

Learn More

API Reference

Primitives

ABI

ABI encoding and decoding. Supports functions, events, errors, and constructors per the ABI specification. View docs →

AccessList

EIP-2930 transaction access lists for optimized state access costs. View docs →

Address

20-byte Ethereum addresses with EIP-55 checksumming and CREATE/CREATE2 calculation. View docs →

Authorization

EIP-7702 authorization lists for account abstraction code delegation. View docs →

Base64

RFC 4648 Base64 encoding and decoding. View docs →

BinaryTree

Binary tree structures for Merkle trees and similar data structures. View docs →

Blob

EIP-4844 blob transaction data (128KB blobs). View docs →

BloomFilter

Ethereum log bloom filters for efficient log filtering. View docs →

Bytecode

Contract bytecode manipulation, analysis, and metadata handling. View docs →

Chain

Chain configuration and network parameters. View docs →

ChainId

Network identifiers (mainnet, testnets, L2s). View docs →

Denomination

Ether denomination conversions (wei, gwei, ether). View docs →

Ens

ENS name normalization per ENSIP-15. View docs →

EventLog

Transaction event log parsing and filtering. View docs →

FeeMarket

EIP-1559 fee market calculations (base fee, priority fee). View docs →

GasConstants

EVM gas costs per the Yellow Paper specification. View docs →

Hardfork

Network hardfork detection and feature flags. View docs →

Hash

32-byte hash type with constant-time operations. View docs →

Hex

Hexadecimal encoding with sized types and manipulation utilities. View docs →

Int

Signed integer types (Int8, Int16, Int32, Int64, Int128, Int256). View docs →

Nonce

Transaction nonce management. View docs →

Opcode

EVM opcodes with gas costs and metadata. View docs →

PrivateKey

Private key operations including signing and address derivation. View docs →

PublicKey

Public key operations including verification and address derivation. View docs →

Rlp

Recursive Length Prefix encoding and decoding. View docs →

Signature

ECDSA signatures (secp256k1, P-256, Ed25519) with recovery and normalization. View docs →

Siwe

Sign-In with Ethereum (EIP-4361) authentication. View docs →

State

Account state management and storage slots. View docs →

Transaction

All Ethereum transaction types (Legacy, EIP-2930, EIP-1559, EIP-4844, EIP-7702). View docs →

Uint

Unsigned integer types (Uint8, Uint16, Uint32, Uint64, Uint128, Uint256). View docs →

Cryptography

AesGcm

AES-GCM authenticated encryption per NIST SP 800-38D. View docs →

Bip39

BIP-39 mnemonic phrase generation and validation. View docs →

Blake2

Blake2 hash function per RFC 7693. View docs →

Bls12381

BLS12-381 elliptic curve operations for Ethereum consensus layer. View docs →

Bn254

BN254 (alt_bn128) elliptic curve for zkSNARK verification. View docs →

Ed25519

Ed25519 EdDSA signatures per RFC 8032. View docs →

EIP712

EIP-712 typed structured data signing. View docs →

HDWallet

BIP-32/BIP-44 hierarchical deterministic wallet key derivation. View docs →

Keccak256

Keccak-256 hash function (primary Ethereum hash) per FIPS 202. View docs →

Kzg

KZG polynomial commitments for EIP-4844 blob verification. View docs →

P256

NIST P-256 (secp256r1) elliptic curve per FIPS 186-5. View docs →

Pbkdf2

PBKDF2 key derivation function. View docs →

Poseidon

Poseidon hash function for zero-knowledge proofs. View docs →

Ripemd160

RIPEMD-160 hash function. View docs →

Schnorr

Schnorr signatures for Bitcoin compatibility. View docs →

Secp256k1

Secp256k1 ECDSA for Ethereum transaction signing. View docs →

Secp256r1

Secp256r1 (P-256) ECDSA signatures. View docs →

Sha256

SHA-256 hash function per FIPS 180-4. View docs →

Sha3

SHA-3 hash function family per FIPS 202. View docs →

Sha512

SHA-512 hash function per FIPS 180-4. View docs →

X25519

X25519 ECDH key exchange per RFC 7748. View docs →