P2SH_addr
Module for P2SH address encoding/decoding.
- class P2SHAddrConst
Bases:
object
Class container for P2SH constants.
- SCRIPT_BYTES: bytes = b'\x00\x14'
- class P2SHAddrDecoder
Bases:
IAddrDecoder
P2SH address decoder class. It allows the Pay-to-Script-Hash address decoding.
- static DecodeAddr(addr: str, **kwargs: Any) bytes
Decode a P2SH address to bytes.
- Parameters:
addr (str) – Address string
net_ver (bytes) – Expected net address version
- Returns:
Script signature hash bytes
- Return type:
bytes
- Raises:
ValueError – If the address encoding is not valid
- class P2SHAddrEncoder
Bases:
IAddrEncoder
P2SH address encoder class. It allows the Pay-to-Script-Hash address encoding.
- static EncodeKey(pub_key: Union[bytes, IPublicKey], **kwargs: Any) str
Encode a public key to P2SH address.
- Parameters:
pub_key (bytes or IPublicKey) – Public key bytes or object
net_ver (bytes) – Net address version
- Returns:
Address string
- Return type:
str
- Raises:
ValueError – If the public key is not valid
TypeError – If the public key is not secp256k1
- class BchP2SHAddrDecoder
Bases:
IAddrDecoder
Bitcoin Cash P2SH address decoder class. It allows the Bitcoin Cash P2SH decoding.
- static DecodeAddr(addr: str, **kwargs: Any) bytes
Decode a Bitcoin Cash P2SH address to bytes.
- Parameters:
addr (str) – Address string
hrp (str) – Expected HRP
net_ver (bytes) – Expected net address version
- Returns:
Script signature hash bytes
- Return type:
bytes
- Raises:
ValueError – If the address encoding is not valid
- class BchP2SHAddrEncoder
Bases:
IAddrEncoder
Bitcoin Cash P2SH address encoder class. It allows the Bitcoin Cash P2SH encoding.
- static EncodeKey(pub_key: Union[bytes, IPublicKey], **kwargs: Any) str
Encode a public key to Bitcoin Cash P2SH address.
- Parameters:
pub_key (bytes or IPublicKey) – Public key bytes or object
hrp (str) – HRP
net_ver (bytes) – Net address version
- Returns:
Address string
- Return type:
str
- Raises:
ValueError – If the public key is not valid
TypeError – If the public key is not secp256k1
- P2SHAddr
alias of
P2SHAddrEncoder
- BchP2SHAddr
alias of
BchP2SHAddrEncoder