Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if not tx_is_correct:
puts(colored.red('TX Error: Tx NOT Signed or Broadcast'))
puts(colored.red(err_msg))
# Abandon
return
privkeyhex_list, pubkeyhex_list = [], []
for _ in unsigned_tx['tx']['inputs']:
privkeyhex_list.append(wif_obj.get_key())
pubkeyhex_list.append(wif_obj.get_public_key().get_key(
compressed=True))
verbose_print('Private Key List: %s' % privkeyhex_list)
verbose_print('Public Key List: %s' % pubkeyhex_list)
# sign locally
tx_signatures = make_tx_signatures(
txs_to_sign=unsigned_tx['tosign'],
privkey_list=privkeyhex_list,
pubkey_list=pubkeyhex_list,
)
verbose_print('TX Signatures: %s' % tx_signatures)
# TODO: add final confirmation before broadcast
broadcasted_tx = broadcast_signed_transaction(
unsigned_tx=unsigned_tx,
signatures=tx_signatures,
pubkeys=pubkeyhex_list,
coin_symbol=coin_symbol,
api_key=BLOCKCYPHER_API_KEY,
)
verbose_print('Broadcasted TX')
verbose_print('hexkeypair_dict:')
verbose_print(hexkeypair_dict)
if len(hexkeypair_dict.keys()) != len(set(input_addresses)):
notfound_addrs = set(input_addresses) - set(hexkeypair_dict.keys())
err_msg = "Couldn't find %s traversing bip32 key" % notfound_addrs
raise Exception('Traversal Fail: %s' % err_msg)
privkeyhex_list = [hexkeypair_dict[x]['privkeyhex'] for x in input_addresses]
pubkeyhex_list = [hexkeypair_dict[x]['pubkeyhex'] for x in input_addresses]
verbose_print('Private Key List: %s' % privkeyhex_list)
verbose_print('Public Key List: %s' % pubkeyhex_list)
# sign locally
tx_signatures = make_tx_signatures(
txs_to_sign=unsigned_tx['tosign'],
privkey_list=privkeyhex_list,
pubkey_list=pubkeyhex_list,
)
verbose_print('TX Signatures: %s' % tx_signatures)
# final confirmation before broadcast
if dest_satoshis == -1:
# remember that sweep TXs cannot verify amounts client-side (only destination addresses)
dest_satoshis_to_display = unsigned_tx['tx']['total'] - unsigned_tx['tx']['fees']
else:
dest_satoshis_to_display = dest_satoshis
CONF_TEXT = "Send %s to %s with a fee of %s (%s%% of the amount you're sending)?" % (
format_crypto_units(
verbose_print('hexkeypair_dict:')
verbose_print(hexkeypair_dict)
if len(hexkeypair_dict.keys()) != len(set(input_addresses)):
notfound_addrs = set(input_addresses) - set(hexkeypair_dict.keys())
err_msg = "Couldn't find %s traversing bip32 key" % notfound_addrs
raise Exception('Traversal Fail: %s' % err_msg)
privkeyhex_list = [hexkeypair_dict[x]['privkeyhex'] for x in input_addresses]
pubkeyhex_list = [hexkeypair_dict[x]['pubkeyhex'] for x in input_addresses]
verbose_print('Private Key List: %s' % privkeyhex_list)
verbose_print('Public Key List: %s' % pubkeyhex_list)
# sign locally
tx_signatures = make_tx_signatures(
txs_to_sign=unsigned_tx['tosign'],
privkey_list=privkeyhex_list,
pubkey_list=pubkeyhex_list,
)
verbose_print('TX Signatures: %s' % tx_signatures)
# final confirmation before broadcast
if dest_satoshis == -1:
# remember that sweep TXs cannot verify amounts client-side (only destination addresses)
dest_satoshis_to_display = unsigned_tx['tx']['total'] - unsigned_tx['tx']['fees']
else:
dest_satoshis_to_display = dest_satoshis
CONF_TEXT = "Send %s to %s with a fee of %s (%s%% of the amount you're sending)?" % (
format_crypto_units(
if not tx_is_correct:
puts(colored.red('TX Error: Tx NOT Signed or Broadcast'))
puts(colored.red(err_msg))
# Abandon
return
privkeyhex_list, pubkeyhex_list = [], []
for _ in unsigned_tx['tx']['inputs']:
privkeyhex_list.append(wif_obj.get_key())
pubkeyhex_list.append(wif_obj.get_public_key().get_key(
compressed=True))
verbose_print('Private Key List: %s' % privkeyhex_list)
verbose_print('Public Key List: %s' % pubkeyhex_list)
# sign locally
tx_signatures = make_tx_signatures(
txs_to_sign=unsigned_tx['tosign'],
privkey_list=privkeyhex_list,
pubkey_list=pubkeyhex_list,
)
verbose_print('TX Signatures: %s' % tx_signatures)
# TODO: add final confirmation before broadcast
broadcasted_tx = broadcast_signed_transaction(
unsigned_tx=unsigned_tx,
signatures=tx_signatures,
pubkeys=pubkeyhex_list,
coin_symbol=coin_symbol,
api_key=BLOCKCYPHER_API_KEY,
)
verbose_print('Broadcasted TX')