Try it Live
Run Address examples in the interactive playground
- TypeScript - Factory
- C
Address.IsValidChecksum({ keccak256 })
Factory function that creates a checksum validator with explicit crypto dependency.Parameters:deps: { keccak256: (data: Uint8Array) => Uint8Array }- Crypto dependencies
(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)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:- Convert address to lowercase hex (without
0x) - Compute keccak256 hash of lowercase string
- For each hex character (if letter):
- If corresponding hash nibble >= 8: uppercase
- Otherwise: lowercase
Common Scenarios
QR Code addresses: Often all uppercase (valid):Error Detection
Checksums help detect typos:- ~99.986% of single character errors
- Most multi-character errors
- 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: UseisValid() if checksum verification not required.
Integration with Parsing
Validate before parsing:See Also
- toChecksummed - Generate checksummed address
- isValid - Validate address format
- fromHex - Parse address from hex
- EIP-55: Mixed-case checksum
- Keccak256 - Keccak256 hash function

