eth_addr
Module for Ethereum address encoding/decoding.
- class EthAddrConst
Bases:
object
Class container for Ethereum address constants.
- START_BYTE: int = 24
- ADDR_LEN: int = 40
- class EthAddrDecoder
Bases:
IAddrDecoder
Ethereum address decoder class. It allows the Ethereum address decoding.
- static DecodeAddr(addr: str, **kwargs: Any) bytes
Decode an Ethereum address to bytes.
- Parameters:
addr (str) – Address string
skip_chksum_enc (bool, optional) – True to skip checksum encoding verification, false otherwise (default)
- Returns:
Public key hash bytes
- Return type:
bytes
- Raises:
ValueError – If the address encoding is not valid
- class EthAddrEncoder
Bases:
IAddrEncoder
Ethereum address encoder class. It allows the Ethereum address encoding.
- static EncodeKey(pub_key: Union[bytes, IPublicKey], **kwargs: Any) str
Encode a public key to Ethereum address.
- Parameters:
pub_key (bytes or IPublicKey) – Public key bytes or object
skip_chksum_enc (bool, optional) – True to skip checksum encoding, false otherwise (default)
- Returns:
Address string
- Return type:
str
- Raised:
ValueError: If the public key is not valid TypeError: If the public key is not secp256k1
- EthAddr
alias of
EthAddrEncoder