Uint8Array.
What is a Branded Type?
A branded type adds a compile-time tag to a base type:Uint8Array. TypeScript prevents you from mixing them up:
Zero Runtime Overhead
The brand is a phantom type - it exists only in TypeScript’s type system:Validation at Construction
Branded types are validated when created. If you have anAddressType, it’s valid:
Console Formatting
Branded types display nicely when logged:Using Branded Types in Function Signatures
Use branded types in your function parameters:API Documentation Note
All Voltaire documentation shows the recommended API using constructors likeAddress(), Hash(), etc. These return instances with prototype methods.
For bundle-size optimization, Voltaire also provides a tree-shakeable functional API with the same method signatures but imported as standalone functions.
All Branded Types
| Type | Size | Description |
|---|---|---|
| AddressType | 20 bytes | Ethereum address |
| HashType | 32 bytes | Keccak256 hash |
| BytecodeType | Variable | EVM bytecode |
| BlobType | 128 KB | EIP-4844 blob |
| HexType | Variable | Hex string (0x...) |
| Uint8Type | 1 byte | 8-bit unsigned integer |
| Uint16Type | 2 bytes | 16-bit unsigned integer |
| Uint32Type | 4 bytes | 32-bit unsigned integer |
| Uint64Type | 8 bytes | 64-bit unsigned integer |
| Uint128Type | 16 bytes | 128-bit unsigned integer |
| Uint256Type | 32 bytes | 256-bit unsigned integer |
| Int8Type | 1 byte | 8-bit signed integer |
| Int16Type | 2 bytes | 16-bit signed integer |
| Int32Type | 4 bytes | 32-bit signed integer |
| Int64Type | 8 bytes | 64-bit signed integer |
| Int128Type | 16 bytes | 128-bit signed integer |
| Int256Type | 32 bytes | 256-bit signed integer |
| Bytes1-32 | 1-32 bytes | Fixed-size byte arrays |
| Bytes64 | 64 bytes | 64-byte array (signatures) |
| WeiType | bigint | Wei denomination |
| GweiType | bigint | Gwei denomination |
| EtherType | bigint | Ether denomination |
| AccessListType | Variable | EIP-2930 access list |
| AuthorizationType | Variable | EIP-7702 authorization |
| SignatureType | 64-65 bytes | ECDSA/Ed25519 signature |
| SelectorType | 4 bytes | Function selector |
| CallDataType | Variable | Contract call data |
| EventLogType | Variable | Event log entry |
| ReceiptType | Variable | Transaction receipt |
| NonceType | bigint | Account nonce |
| BlockNumberType | bigint | Block number |
| TransactionHashType | 32 bytes | Transaction hash |
| BlockHashType | 32 bytes | Block hash |
| GasLimitType | bigint | Gas limit |
| GasPriceType | bigint | Gas price |
| PrivateKeyType | 32 bytes | Private key |
| PublicKeyType | 64 bytes | Uncompressed public key |
| Base64Type | Variable | Base64 encoded string |
| RlpType | Variable | RLP encoded data |
| ChainIdType | number | Chain identifier |
| OpcodeType | number | EVM opcode |

