Skip to main content

Try it Live

Run Address examples in the interactive playground

Address.IsValidChecksum({ keccak256 })

Factory function that creates a checksum validator with explicit crypto dependency.Parameters:
  • deps: { keccak256: (data: Uint8Array) => Uint8Array } - Crypto dependencies
Returns: (str: string) => booleanBundle size benefit: Crypto dependencies explicit - only bundled if you import them.Example:

EIP-55 Checksum Rules

All lowercase: Valid (no checksum to verify)
All uppercase: Valid (no checksum to verify)
Mixed case: Must match keccak256-based checksum

Use Cases

Strict Validation

Require checksummed addresses:

Warn on Invalid Checksum

Accept but warn about invalid checksums:

UI Validation

Provide checksum feedback in forms:

Accept Lowercase, Return Checksummed

Accept any valid format, return checksummed:

Checksum Calculation

The checksum is computed as follows:
  1. Convert address to lowercase hex (without 0x)
  2. Compute keccak256 hash of lowercase string
  3. For each hex character (if letter):
    • If corresponding hash nibble >= 8: uppercase
    • Otherwise: lowercase
Example:

Common Scenarios

QR Code addresses: Often all uppercase (valid):
Database addresses: Often lowercase (valid):
User input: May have incorrect checksum (invalid):

Error Detection

Checksums help detect typos:
Detection rate: EIP-55 checksums can detect:
  • ~99.986% of single character errors
  • Most multi-character errors
Not detected:
  • All lowercase → all lowercase (no checksum)
  • All uppercase → all uppercase (no checksum)

Performance

Cryptographic operation: Uses keccak256 hash internally. Bundle size impact: With the factory pattern, keccak256 is only bundled if you explicitly import it. Crypto dependencies are now explicit and tree-shakeable. Alternative: Use isValid() if checksum verification not required.

Integration with Parsing

Validate before parsing:
Parse then validate:

See Also