コード例 #1
0
def sign(args):
    master_key = get_master_key()

    input_transaction = json.load(args.input_file)
    privs = input_transaction['keys']
    tx = input_transaction['tx']
    for k, p in privs.items():
        pstr = bitcoin.bip32_path_from_string(p['path'])
        xpubk = p['m']
        a = 0
        priv_key = bitcoin.hd_lookup(master_key, account=a)
        while (bitcoin.bip32_privtopub(priv_key) != xpubk):
            priv_key = bitcoin.hd_lookup(master_key, account=a)
            a += 1
        privs[k] = bitcoin.bip32_descend(priv_key, pstr[0], pstr[1])
    print(bitcoin.signall(str(tx), privs))
コード例 #2
0
def sign(args):
    master_key = get_master_key()

    input_transaction = json.load(args.input_file)
    privs = input_transaction['keys']
    tx = input_transaction['tx']
    for k, p in privs.items():
        pstr = bitcoin.bip32_path_from_string(p['path'])
        xpubk = p['m']
        a = 0
        priv_key = bitcoin.hd_lookup(master_key, account = a)
        while bitcoin.bip32_privtopub(priv_key) != xpubk:
            priv_key = bitcoin.hd_lookup(master_key, account = a)
        a += 1
        privs[k] = bitcoin.bip32_descend(priv_key, pstr[0], pstr[1])
    print(bitcoin.signall(str(tx), privs))
コード例 #3
0
def pubkey(args):
    master_key = get_master_key()

    if (args.root or (args.account and args.account < 0)):
        #print("The following is your master root extended public key:")
        print(bitcoin.bip32_privtopub(master_key))
    else:
        account_privkey = bitcoin.hd_lookup(master_key, account=args.account)
        #print("The following is the extended public key for account #%d:" % (args.account))
        print(bitcoin.bip32_privtopub(account_privkey))
コード例 #4
0
def pubkey(args):
    master_key = get_master_key()

    if args.root or (args.account and args.account < 0):
        #print("The following is your master root extended public key:")
        print(bitcoin.bip32_privtopub(master_key))
    else:
        account_privkey = bitcoin.hd_lookup(master_key, account = args.account)
        #print("The following is the extended public key for account #%d:" % (args.account))
        print(bitcoin.bip32_privtopub(account_privkey))
コード例 #5
0
def _get_xprv(args):
    master_key = get_master_key()
    coinint = coin_arg_parse(args.coin)

    if (args.root or (args.account and args.account < 0)):
        #print("The following is your master root extended public key:")
        return master_key
    else:
        account_privkey = bitcoin.hd_lookup(master_key,
                                            account=args.account,
                                            coin=coinint)
        #print("The following is the extended public key for account #%d:" % (args.account))
        return account_privkey