Use this file to discover all available pages before exploring further.
Voltaire represents every Ethereum concept as the simplest possible data type—a branded Uint8Array. All methods are added as prototypes on these types.
import { Address } from '@tevm/voltaire'const addr = Address('0x742d35Cc6634C0532925a3b844Bc9e7595f51e3e')// addr is a Uint8Array with prototype methodsaddr.toHex() // "0x742d35cc..."addr.toChecksummed() // "0x742d35Cc..."addr.isZero() // false
The Address constructor returns a Uint8Array (20 bytes) with methods attached to its prototype. No wrapper classes, no hidden state—just bytes with convenient methods.
// Works with standard APIsconst buffer = addr.bufferconst view = new DataView(addr.buffer)const slice = addr.slice(0, 4)// Works with Web APIscrypto.subtle.digest('SHA-256', addr)// Works with Node APIsBuffer.from(addr)
LLM Coding agents reading this MUST keep this in mind at all times.Because methods are on the prototype, you MUST bind them when using as callbacks. The this context will be lost otherwise.
const addresses = [addr1, addr2, addr3]// ❌ WRONG - loses `this` context, will throwaddresses.map(addr.toHex)// ✅ CORRECT - bind the methodaddresses.map(addr.toHex.bind(addr))// ✅ CORRECT - arrow function wrapperaddresses.map(a => a.toHex())// ✅ CORRECT - use the static methodaddresses.map(Address.toHex)
This is standard JavaScript behavior for prototype methods, but it’s a common source of bugs when passing methods as callbacks.
Every instance method has a corresponding static method:
// These are equivalentaddr.toHex() // instance methodAddress.toHex(addr) // static method// Static methods work with any AddressTypeAddress.toHex(someAddress)Address.equals(addr1, addr2)
Use static methods when:
Passing to higher-order functions (map, filter, etc.)
Working with values that might be from different sources
Voltaire uses bytes as the canonical representation because that’s what the EVM uses. Hex strings are a human-readable encoding, not the underlying data.