gleeth/ethereum/address

EIP-55 checksummed Ethereum addresses.

Ethereum addresses are 20-byte hex strings. EIP-55 defines a mixed-case encoding that serves as a checksum: each hex character is uppercased if the corresponding nibble of the keccak256 hash of the lowercase address is >= 8.

Examples

address.checksum("0xd8da6bf26964af9d7eed9e03e53415d37aa96045")
// -> Ok("0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045")

Values

pub fn checksum(address: String) -> Result(String, String)

Produce the EIP-55 checksummed form of an Ethereum address.

pub fn is_valid_checksum(address: String) -> Bool

Check whether a mixed-case address has a valid EIP-55 checksum. All-lowercase and all-uppercase addresses are considered valid (no checksum applied).

pub fn to_lowercase(address: String) -> Result(String, String)

Convert a potentially checksummed address to lowercase with 0x prefix.

Search Document