Skip to main content
Voltaire represents every Ethereum concept as the simplest possible data type—a branded Uint8Array. All methods are added as prototypes on these types.

The Pattern

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.

Why Data-First?

Prototype Methods

All methods are attached to the prototype of the branded type:

Binding Required for Callbacks

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.
This is standard JavaScript behavior for prototype methods, but it’s a common source of bugs when passing methods as callbacks.

Static vs Instance Methods

Every instance method has a corresponding static method:
Use static methods when:
  • Passing to higher-order functions (map, filter, etc.)
  • Working with values that might be from different sources
  • You prefer functional style

Comparison with Other Libraries

ethers.js

viem

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.

Learn More

Branded Types

Type safety without runtime overhead

Tree-Shakeable API

Functional API for minimal bundles