def address_p2sh(redeem_script_hash: bytes, addrtype: int) -> str: s = addrtype_bytes(addrtype) + redeem_script_hash return base58.encode_check(bytes(s))
def address_pkh(pubkey: bytes, addrtype: int) -> str: s = addrtype_bytes(addrtype) + sha256_ripemd160_digest(pubkey) return base58.encode_check(bytes(s))