コード例 #1
0
ファイル: trustedcoin.py プロジェクト: zhiyuan2007/electrum
def make_billing_address(wallet, num, addr_type):
    long_id, short_id = wallet.get_user_id()
    xpub = make_xpub(get_billing_xpub(), long_id)
    version, _, _, _, c, cK = deserialize_xpub(xpub)
    cK, c = CKD_pub(cK, c, num)
    if addr_type == 'legacy':
        return bitcoin.public_key_to_p2pkh(cK)
    elif addr_type == 'segwit':
        return bitcoin.public_key_to_p2wpkh(cK)
    else:
        raise ValueError(f'unexpected billing type: {addr_type}')
コード例 #2
0
ファイル: trustedcoin.py プロジェクト: vialectrum/vialectrum
def make_billing_address(wallet, num, addr_type):
    long_id, short_id = wallet.get_user_id()
    xpub = make_xpub(get_billing_xpub(), long_id)
    version, _, _, _, c, cK = deserialize_xpub(xpub)
    cK, c = CKD_pub(cK, c, num)
    if addr_type == 'legacy':
        return bitcoin.public_key_to_p2pkh(cK)
    elif addr_type == 'segwit':
        return bitcoin.public_key_to_p2wpkh(cK)
    else:
        raise ValueError(f'unexpected billing type: {addr_type}')
コード例 #3
0
ファイル: trustedcoin.py プロジェクト: oliv3eira/electrum
def make_billing_address(wallet, num, addr_type):
    long_id, short_id = wallet.get_user_id()
    xpub = make_xpub(get_billing_xpub(), long_id)
    usernode = BIP32Node.from_xkey(xpub)
    child_node = usernode.subkey_at_public_derivation([num])
    pubkey = child_node.eckey.get_public_key_bytes(compressed=True)
    if addr_type == 'legacy':
        return bitcoin.public_key_to_p2pkh(pubkey)
    elif addr_type == 'segwit':
        return bitcoin.public_key_to_p2wpkh(pubkey)
    else:
        raise ValueError(f'unexpected billing type: {addr_type}')
コード例 #4
0
ファイル: trustedcoin.py プロジェクト: faircoin/electrumfair
def make_billing_address(wallet, num, addr_type):
    long_id, short_id = wallet.get_user_id()
    xpub = make_xpub(get_billing_xpub(), long_id)
    usernode = BIP32Node.from_xkey(xpub)
    child_node = usernode.subkey_at_public_derivation([num])
    pubkey = child_node.eckey.get_public_key_bytes(compressed=True)
    if addr_type == 'legacy':
        return bitcoin.public_key_to_p2pkh(pubkey)
    elif addr_type == 'segwit':
        return bitcoin.public_key_to_p2wpkh(pubkey)
    else:
        raise ValueError(f'unexpected billing type: {addr_type}')