Skip to main content
TypeScript is structurally typed: two aliases for Uint8Array or `0x${string}` are completely interchangeable. Voltaire attaches a phantom unique symbol brand to every primitive so the compiler rejects mixing an Address with a Hash, Bytecode, or Wei with Gwei — while emitting plain Uint8Array or bigint at runtime.

How Branding Works

All primitives share a single unique symbol exported from @tevm/voltaire:
The brand property never exists on the object at runtime. Because AddressType and HashType carry distinct literal tags under [brand], TypeScript rejects swapped arguments:

Validate Once at the Boundary

Every constructor validates length, character set, and range immediately. If a value has type AddressType, it is guaranteed to be exactly 20 bytes:
Because Address stores 20 raw bytes rather than a string, case-sensitivity bugs disappear:

Core Branded Types

Never cast raw strings or Uint8Array with as AddressType — doing so bypasses construction-time validation and breaks the invariant that every branded value is valid. Always construct through Address(...) or Address.fromBytes(...).