ergo_addr
Module for Ergo address encoding/decoding.
- class ErgoAddressTypes(value)
Bases:
IntEnum
Enumerative for Ergo address types.
- P2PKH = 1
- P2SH = 2
- class ErgoNetworkTypes(value)
Bases:
IntEnum
Enumerative for Ergo network types.
- MAINNET = 0
- TESTNET = 16
- class ErgoAddrConst
Bases:
object
Class container for Ergo address constants.
- CHECKSUM_BYTE_LEN: int = 4
- class ErgoP2PKHAddrDecoder
Bases:
IAddrDecoder
Ergo P2PKH address decoder class. It allows the Ergo P2PKH address decoding.
- static DecodeAddr(addr: str, **kwargs: Any) bytes
Decode an Ergo P2PKH address to bytes.
- Parameters:
addr (str) – Address string
net_type (ErgoNetworkTypes) – Expected network type (default: main net)
- Returns:
Public key bytes
- Return type:
bytes
- Raises:
ValueError – If the address encoding is not valid
TypeError – If the network tag is not a ErgoNetworkTypes enum
- class ErgoP2PKHAddrEncoder
Bases:
IAddrEncoder
Ergo P2PKH address encoder class. It allows the Ergo P2PKH address encoding.
- static EncodeKey(pub_key: Union[bytes, IPublicKey], **kwargs: Any) str
Encode a public key to Ergo P2PKH address.
- Parameters:
pub_key (bytes or IPublicKey) – Public key bytes or object
net_type (ErgoNetworkTypes) – Network type (default: main net)
- Returns:
Address string
- Return type:
str
- Raised:
ValueError: If the public key is not valid TypeError: If the public key is not secp256k1 or the network tag is not a ErgoNetworkTypes enum
- ErgoP2PKHAddr
alias of
ErgoP2PKHAddrEncoder