Skip to main content

Try it Live

Run Address examples in the interactive playground

Checksummed

EIP-55 checksummed address type providing mixed-case format for display and integrity verification.

Overview

Checksummed is a branded hex string type representing an Ethereum address with EIP-55 checksum encoding. Unlike AddressType (a Uint8Array), Checksummed is a string with mixed casing that encodes integrity verification in the character case. Key characteristics:
  • Type: Branded string (not Uint8Array)
  • Format: Mixed-case hex (e.g., 0x742d35Cc6634C0532925a3b844Bc9e7595f51e3e)
  • Use cases: UI display, user input validation, QR codes, wallet integrations
  • Validation: Checksum encodes keccak256 hash for detecting typos

Type Definition

Branded string with EIP-55 mixed-case checksum extending Hex.Sized<20>. Defined in: primitives/Address/AddressType/ChecksumAddress.js:8

ChecksumAddress API

ChecksumAddress.from(value)

Create checksummed address from any input format.Parameters:
  • value: number | bigint | string | Uint8Array - Input to convert
Returns: Checksummed - EIP-55 checksummed hex stringNote: Uses keccak256 internally. Import keccak256 hash function to use this API.Defined in: primitives/Address/AddressType/ChecksumAddress.js:23Example:

ChecksumAddress.isValid(str)

Validate EIP-55 checksum of address string.Parameters:
  • str: string - Address string to validate
Returns: boolean - true if checksum is validNote: Uses keccak256 internally. Import keccak256 hash function to use this API.Defined in: primitives/Address/AddressType/ChecksumAddress.js:63EIP-55 Logic:
  • If all letters same case (all lower OR all upper), valid
  • If mixed case, each letter’s case must match keccak256-based checksum
  • Zero address with all same case always valid
Example:

EIP-55 Checksum Algorithm

The checksum encodes integrity verification in hexadecimal character casing:
  1. Convert address to lowercase hex (without 0x prefix)
  2. Compute keccak256 hash of lowercase hex string
  3. For each hex character:
    • If character is a letter (a-f):
      • If corresponding hash nibble >= 8: uppercase
      • Otherwise: lowercase
    • If character is a digit (0-9): unchanged
Pseudocode:

Use Cases

UI Display

Display addresses with integrity verification:

User Input Validation

Validate user-provided addresses and detect typos:

QR Codes

Use checksummed addresses in QR codes for error detection:

Wallet Integrations

Wallets expect checksummed addresses:

Storage

Store addresses with checksums for verification on retrieval:

Comparison with Other Formats

Example Walkthrough

Breakdown:
  1. Lowercase hex: 5aaeb6053f3e94c9b9a09f33669435e7ef1beaed
  2. Keccak256 hash of lowercase: ce1b9e8e5e10a90a16c6c3ae3f56c5cf99d82e39c703c1a2adcdf2bd7ad9d685
  3. For each letter character:
    • a at position 1: hash nibble = c (12) >= 8 → A
    • a at position 2: hash nibble = e (14) >= 8 → A
    • e at position 3: hash nibble = 1 (1) < 8 → e
    • And so on…

Performance

Time complexity: O(n) where n = 20 bytes (constant time) Overhead: One keccak256 hash computation For repeated conversions, consider caching:

Bundle Size Considerations

With the factory pattern, keccak256 is only bundled if you explicitly import it. Crypto dependencies are now explicit and tree-shakeable.
Tree-shaking:
  • ChecksumAddress.From({ keccak256 }) → Crypto dependencies explicit - only bundled if imported
  • ChecksumAddress.IsValid({ keccak256 }) → Crypto dependencies explicit - only bundled if imported
  • Address.toLowercase() → No crypto dependencies
  • Address.toUppercase() → No crypto dependencies
Selective imports for optimal bundle size: