コード例 #1
0
def parse_xpub(x_pubkey):
    if x_pubkey[0:2] == 'ff':
        from account import BIP32_Account
        xpub, s = BIP32_Account.parse_xpubkey(x_pubkey)
        pubkey = BIP32_Account.get_pubkey_from_x(xpub, s[0], s[1])
    elif x_pubkey[0:2] == 'fe':
        from account import OldAccount
        mpk, s = OldAccount.parse_xpubkey(x_pubkey)
        pubkey = OldAccount.get_pubkey_from_mpk(mpk.decode('hex'), s[0], s[1])
    else:
        pubkey = x_pubkey
    return pubkey
コード例 #2
0
def parse_xpub(x_pubkey):
    if x_pubkey[0:2] == 'ff':
        from account import BIP32_Account
        xpub, s = BIP32_Account.parse_xpubkey(x_pubkey)
        pubkey = BIP32_Account.derive_pubkey_from_xpub(xpub, s[0], s[1])
    elif x_pubkey[0:2] == 'fe':
        from account import OldAccount
        mpk, s = OldAccount.parse_xpubkey(x_pubkey)
        pubkey = OldAccount.get_pubkey_from_mpk(mpk.decode('hex'), s[0], s[1])
    else:
        pubkey = x_pubkey
    return pubkey
コード例 #3
0
ファイル: transaction.py プロジェクト: mrtexaznl/electrum-med
def parse_xpub(x_pubkey):
    if x_pubkey[0:2] == "ff":
        from account import BIP32_Account

        xpub, s = BIP32_Account.parse_xpubkey(x_pubkey)
        pubkey = BIP32_Account.derive_pubkey_from_xpub(xpub, s[0], s[1])
    elif x_pubkey[0:2] == "fe":
        from account import OldAccount

        mpk, s = OldAccount.parse_xpubkey(x_pubkey)
        pubkey = OldAccount.get_pubkey_from_mpk(mpk.decode("hex"), s[0], s[1])
    else:
        pubkey = x_pubkey
    return pubkey
コード例 #4
0
ファイル: transaction.py プロジェクト: Lexiks/electrum
def parse_xpub(x_pubkey):
    if x_pubkey[0:2] in ['02','03','04']:
        pubkey = x_pubkey
    elif x_pubkey[0:2] == 'ff':
        from account import BIP32_Account
        xpub, s = BIP32_Account.parse_xpubkey(x_pubkey)
        pubkey = BIP32_Account.derive_pubkey_from_xpub(xpub, s[0], s[1])
    elif x_pubkey[0:2] == 'fe':
        from account import OldAccount
        mpk, s = OldAccount.parse_xpubkey(x_pubkey)
        pubkey = OldAccount.get_pubkey_from_mpk(mpk.decode('hex'), s[0], s[1])
    else:
        raise BaseException("Cannnot parse pubkey")
    return pubkey
コード例 #5
0
    def inputs_to_sign(self):
        from account import BIP32_Account, OldAccount
        xpub_list = []
        addr_list = set()
        for txin in self.inputs:
            x_signatures = txin['signatures']
            signatures = filter(lambda x: x is not None, x_signatures)

            if len(signatures) == txin['num_sig']:
                # input is complete
                continue

            for k, x_pubkey in enumerate(txin['x_pubkeys']):

                if x_signatures[k] is not None:
                    # this pubkey already signed
                    continue

                if x_pubkey[0:2] == 'ff':
                    xpub, sequence = BIP32_Account.parse_xpubkey(x_pubkey)
                    xpub_list.append((xpub, sequence))
                elif x_pubkey[0:2] == 'fe':
                    xpub, sequence = OldAccount.parse_xpubkey(x_pubkey)
                    xpub_list.append((xpub, sequence))
                else:
                    addr_list.add(txin['address'])

        return addr_list, xpub_list
コード例 #6
0
    def inputs_to_sign(self):
        from account import BIP32_Account, OldAccount
        xpub_list = []
        addr_list = set()
        for txin in self.inputs:
            x_signatures = txin['signatures']
            signatures = filter(lambda x: x is not None, x_signatures)

            if len(signatures) == txin['num_sig']:
                # input is complete
                continue

            for k, x_pubkey in enumerate(txin['x_pubkeys']):

                if x_signatures[k] is not None:
                    # this pubkey already signed
                    continue

                if x_pubkey[0:2] == 'ff':
                    xpub, sequence = BIP32_Account.parse_xpubkey(x_pubkey)
                    xpub_list.append((xpub,sequence))
                elif x_pubkey[0:2] == 'fe':
                    xpub, sequence = OldAccount.parse_xpubkey(x_pubkey)
                    xpub_list.append((xpub,sequence))
                else:
                    addr_list.add(txin['address'])

        return addr_list, xpub_list
コード例 #7
0
def parse_xpub(x_pubkey):
    if x_pubkey[0:2] in ['02', '03', '04']:
        pubkey = x_pubkey
    elif x_pubkey[0:2] == 'ff':
        from account import BIP32_Account
        xpub, s = BIP32_Account.parse_xpubkey(x_pubkey)
        pubkey = BIP32_Account.derive_pubkey_from_xpub(xpub, s[0], s[1])
    elif x_pubkey[0:2] == 'fd':
        addrtype = ord(x_pubkey[2:4].decode('hex'))
        hash160 = x_pubkey[4:].decode('hex')
        pubkey = None
        address = hash_160_to_bc_address(hash160, addrtype)
    else:
        raise BaseException("Cannnot parse pubkey")
    if pubkey:
        address = public_key_to_bc_address(pubkey.decode('hex'))
    return pubkey, address
コード例 #8
0
ファイル: transaction.py プロジェクト: akshayaurora/electrum
def parse_xpub(x_pubkey):
    if x_pubkey[0:2] in ['02','03','04']:
        pubkey = x_pubkey
    elif x_pubkey[0:2] == 'ff':
        from account import BIP32_Account
        xpub, s = BIP32_Account.parse_xpubkey(x_pubkey)
        pubkey = BIP32_Account.derive_pubkey_from_xpub(xpub, s[0], s[1])
    elif x_pubkey[0:2] == 'fe':
        from account import OldAccount
        mpk, s = OldAccount.parse_xpubkey(x_pubkey)
        pubkey = OldAccount.get_pubkey_from_mpk(mpk.decode('hex'), s[0], s[1])
    elif x_pubkey[0:2] == 'fd':
        addrtype = ord(x_pubkey[2:4].decode('hex'))
        hash160 = x_pubkey[4:].decode('hex')
        pubkey = None
        address = hash_160_to_bc_address(hash160, addrtype)
    else:
        raise BaseException("Cannnot parse pubkey")
    if pubkey:
        address = public_key_to_bc_address(pubkey.decode('hex'))
    return pubkey, address
コード例 #9
0
def parse_xpub(x_pubkey):
    active_chain = chainparams.get_active_chain()
    if x_pubkey[0:2] in ['02','03','04']:
        pubkey = x_pubkey
    elif x_pubkey[0:2] == 'ff':
        from account import BIP32_Account
        xpub, s = BIP32_Account.parse_xpubkey(x_pubkey)
        pubkey = BIP32_Account.derive_pubkey_from_xpub(xpub, s[0], s[1])
    elif x_pubkey[0:2] == 'fe':
        from account import OldAccount
        mpk, s = OldAccount.parse_xpubkey(x_pubkey)
        pubkey = OldAccount.get_pubkey_from_mpk(mpk.decode('hex'), s[0], s[1])
    elif x_pubkey[0:2] == 'fd':
        addrtype = ord(x_pubkey[2:4].decode('hex'))
        hash160 = x_pubkey[4:].decode('hex')
        pubkey = None
        address = hash_160_to_bc_address(hash160, active_chain.p2pkh_version)
    else:
        raise BaseException("Cannnot parse pubkey")
    if pubkey:
        address = public_key_to_bc_address(pubkey.decode('hex'), active_chain.p2pkh_version)
    return pubkey, address
コード例 #10
0
def parse_xpub(x_pubkey):
    if x_pubkey[0:2] in ["02", "03", "04"]:
        pubkey = x_pubkey
    elif x_pubkey[0:2] == "ff":
        from account import BIP32_Account

        xpub, s = BIP32_Account.parse_xpubkey(x_pubkey)
        pubkey = BIP32_Account.derive_pubkey_from_xpub(xpub, s[0], s[1])
    elif x_pubkey[0:2] == "fe":
        from account import OldAccount

        mpk, s = OldAccount.parse_xpubkey(x_pubkey)
        pubkey = OldAccount.get_pubkey_from_mpk(mpk.decode("hex"), s[0], s[1])
    elif x_pubkey[0:2] == "fd":
        addrtype = ord(x_pubkey[2:4].decode("hex"))
        hash160 = x_pubkey[4:].decode("hex")
        pubkey = None
        address = hash_160_to_bc_address(hash160, addrtype)
    else:
        raise BaseException("Cannnot parse pubkey")
    if pubkey:
        address = public_key_to_bc_address(pubkey.decode("hex"))
    return pubkey, address
コード例 #11
0
def x_to_xpub(x_pubkey):
    if x_pubkey[0:2] == 'ff':
        from account import BIP32_Account
        xpub, s = BIP32_Account.parse_xpubkey(x_pubkey)
        return xpub
コード例 #12
0
ファイル: transaction.py プロジェクト: akshayaurora/electrum
def x_to_xpub(x_pubkey):
    if x_pubkey[0:2] == 'ff':
        from account import BIP32_Account
        xpub, s = BIP32_Account.parse_xpubkey(x_pubkey)
        return xpub