示例#1
0
def address_multisig_p2sh(pubkeys: bytes, m: int, coin: CoinInfo):
    if coin.address_type_p2sh is None:
        raise AddressError(FailureType.ProcessError,
                           "Multisig not enabled on this coin")
    redeem_script = output_script_multisig(pubkeys, m)
    redeem_script_hash = sha256_ripemd160_digest(redeem_script)
    return address_p2sh(redeem_script_hash, coin)
示例#2
0
def address_multisig_p2sh(pubkeys: bytes, m: int, addrtype: int):
    if addrtype is None:
        raise AddressError(FailureType.ProcessError,
                           'Multisig not enabled on this coin')
    redeem_script = output_script_multisig(pubkeys, m)
    redeem_script_hash = sha256_ripemd160_digest(redeem_script)
    return address_p2sh(redeem_script_hash, addrtype)
示例#3
0
def address_p2wsh_in_p2sh(witness_script_hash: bytes, coin: CoinInfo) -> str:
    redeem_script = output_script_native_p2wpkh_or_p2wsh(witness_script_hash)
    redeem_script_hash = sha256_ripemd160_digest(redeem_script)
    return address_p2sh(redeem_script_hash, coin)
示例#4
0
def address_p2wpkh_in_p2sh(pubkey: bytes, coin: CoinInfo) -> str:
    pubkey_hash = ecdsa_hash_pubkey(pubkey)
    redeem_script = output_script_native_p2wpkh_or_p2wsh(pubkey_hash)
    redeem_script_hash = sha256_ripemd160_digest(redeem_script)
    return address_p2sh(redeem_script_hash, coin)
示例#5
0
def address_pkh(pubkey: bytes, coin: CoinInfo) -> str:
    s = address_type.tobytes(
        coin.address_type) + sha256_ripemd160_digest(pubkey)
    return base58.encode_check(bytes(s), coin.b58_hash)
示例#6
0
def address_pkh(pubkey: bytes, addrtype: int) -> str:
    s = addrtype_bytes(addrtype) + sha256_ripemd160_digest(pubkey)
    return base58.encode_check(bytes(s))