Skip to main content
Voltaire uses distinct types for Ethereum values that other libraries treat as generic bigint or string. This prevents bugs that have caused real financial losses.

The Problem

Consider this ethers.js code:
This code compiles and runs. The bug won’t be caught until someone loses funds.

The Solution

Voltaire makes denomination a type-level concern:
If you have a WeiType, you know it’s in wei. The type system enforces it.

Beyond Denominations

The same pattern applies to other Ethereum concepts that look similar but aren’t interchangeable:

Address vs Hash

Both are hex strings. Both are fixed-size bytes. But mixing them is always a bug:

Numeric Types

Block numbers, chain IDs, and nonces are all numbers—but semantically distinct:

Crypto Types

Private keys, public keys, and signatures have critical security implications:

Comparison with Other Libraries

The difference: Voltaire catches misuse at compile time. Other libraries catch it at runtime (or not at all).

Parse, Don’t Validate

Once you have a typed value, it’s guaranteed valid. This enables a powerful pattern:
This is the “parse, don’t validate” philosophy: validate at system boundaries, then work with guaranteed-valid types throughout your code.

All Typed Values

Learn More

Branded Types

How the type system implements these guarantees

Denomination

Complete Wei/Gwei/Ether API reference