cchecksum package
Submodules
cchecksum.monkey_patch module
Module contents
CChecksum is a ~8x faster drop-in replacement for eth_utils.to_checksum_address, with the most cpu-intensive part implemented in c.
It keeps the exact same API as the existing implementation, exceptions and all.
- cchecksum.monkey_patch_eth_utils()[source]
Monkey patch eth_utils to use cchecksum’s implementation internally.
- Return type:
None
- cchecksum.monkey_patch_web3py()[source]
Monkey patch web3.py to use cchecksum’s implementation internally.
- Return type:
None
- cchecksum.to_checksum_address(value: AnyAddress | str | bytes) str
Convert an address to its EIP-55 checksum format.
This function takes an address in any supported format and returns it in the checksummed format as defined by EIP-55. It uses a custom Cython implementation for the checksum conversion to optimize performance.
- Args:
- value: The address to be converted. It can be in any format supported by
eth_utils.to_normalized_address().
- Raises:
ValueError: If the input address is not in a recognized format. TypeError: If the input is not a string, bytes, or any address type.
- Examples:
>>> to_checksum_address("0xb47e3cd837ddf8e4c57f05d70ab865de6e193bbb") '0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB'
>>> to_checksum_address(b'´~<Ø7ÝøäÅ×
- ¸eÞn;»’)
‘0xb47e3cd837dDF8e4c57F05d70Ab865de6e193BBB’
- See Also:
eth_utils.to_checksum_address()for the standard implementation.to_normalized_address()for converting to a normalized address before checksumming.