bch_addr_converter

Module for converting Bitcoin Cash addresses.

class BchAddrConverter

Bases: object

Bitcoin Cash address converter class. It allows to convert a Bitcoin Cash address by changing its HRP and net version.

static Convert(address: str, hrp: str, net_ver: Optional[bytes] = None) str

Convert a Bitcoin Cash address by changing its HRP and net version.

Parameters:
  • address (str) – Bitcoin Cash address

  • hrp (str) – New HRP

  • net_ver (bytes, optional) – New net version (if None, the old one will be used)

Returns:

Converted address string

Return type:

str

Raises:
  • Bech32ChecksumError – If the address checksum is not valid

  • ValueError – If the address string is not valid