Pay to Public Key Hash Address

class bip38.p2pkh_address.P2PKHAddress
classmethod encode(public_key: bytes | str | PublicKey, **kwargs: Any) str

Encode a public key into an address using a specified address prefix and alphabet.

Parameters:
  • public_key (Union[bytes, str, IPublicKey]) – The public key to encode.

  • kwargs (Any) – Additional keyword arguments. - address_prefix: Address prefix for the public key (optional). - public_key_type: Type of the public key (optional). - alphabet: Custom alphabet for encoding (optional).

Returns:

The encoded address.

Return type:

str

classmethod decode(address: str, **kwargs: Any) str

Decode an address string into a public key hash using a specified address prefix and alphabet.

Parameters:
  • address (str) – The address string to decode.

  • kwargs (Any) – Additional keyword arguments. - address_prefix: Address prefix for the public key (optional). - alphabet: Custom alphabet for decoding (optional).

Returns:

The decoded public key hash as a string.

Return type:

str