cchecksum

0.4.3 · active · verified Thu Apr 16

cchecksum is a Python library that provides an approximately 18x faster, C-implemented drop-in replacement for `eth_utils.to_checksum_address`. It ensures full API compatibility, raising the exact same exceptions as the original `eth_utils` function. Currently at version 0.4.3, the library is actively maintained with a focus on performance optimizations and broad platform compatibility through pre-built wheels.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import and use the `to_checksum_address` function from `cchecksum` with both hexadecimal string and raw bytes inputs, producing an EIP-55 checksummed Ethereum address.

from cchecksum import to_checksum_address
from binascii import unhexlify

# Convert a lowercase hex string with 0x prefix
address_hex_lower = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
checksummed_address = to_checksum_address(address_hex_lower)
print(f"Original: {address_hex_lower}")
print(f"Checksummed: {checksummed_address}")

# Convert bytes input (must be 20 bytes long)
address_bytes = unhexlify(address_hex_lower[2:]) # Removes '0x' prefix
checksummed_bytes_address = to_checksum_address(address_bytes)
print(f"Original Bytes: {address_bytes.hex()}")
print(f"Checksummed Bytes: {checksummed_bytes_address}")

view raw JSON →