• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python pay_to.build_hash160_lookup函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pycoin.tx.pay_to.build_hash160_lookup函数的典型用法代码示例。如果您正苦于以下问题:Python build_hash160_lookup函数的具体用法?Python build_hash160_lookup怎么用?Python build_hash160_lookup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了build_hash160_lookup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_build_spends

    def test_build_spends(self):
        # first, here is the tx database
        TX_DB = {}

        # create a coinbase Tx where we know the public & private key

        exponent = wif_to_secret_exponent("5JMys7YfK72cRVTrbwkq5paxU7vgkMypB55KyXEtN5uSnjV7K8Y")
        compressed = False

        public_key_sec = public_pair_to_sec(
            ecdsa.public_pair_for_secret_exponent(ecdsa.generator_secp256k1, exponent), compressed=compressed
        )

        the_coinbase_tx = Tx.coinbase_tx(public_key_sec, int(50 * 1e8), COINBASE_BYTES_FROM_80971)
        TX_DB[the_coinbase_tx.hash()] = the_coinbase_tx

        # now create a Tx that spends the coinbase

        compressed = False

        exponent_2 = int("137f3276686959c82b454eea6eefc9ab1b9e45bd4636fb9320262e114e321da1", 16)
        bitcoin_address_2 = public_pair_to_bitcoin_address(
            ecdsa.public_pair_for_secret_exponent(ecdsa.generator_secp256k1, exponent_2), compressed=compressed
        )

        self.assertEqual("12WivmEn8AUth6x6U8HuJuXHaJzDw3gHNZ", bitcoin_address_2)

        coins_from = [(the_coinbase_tx.hash(), 0, the_coinbase_tx.txs_out[0])]
        coins_to = [(int(50 * 1e8), bitcoin_address_2)]
        unsigned_coinbase_spend_tx = standard_tx(coins_from, coins_to)
        solver = build_hash160_lookup([exponent])

        coinbase_spend_tx = unsigned_coinbase_spend_tx.sign(solver)

        # now check that it validates
        self.assertEqual(coinbase_spend_tx.bad_signature_count(), 0)

        TX_DB[coinbase_spend_tx.hash()] = coinbase_spend_tx

        ## now try to respend from priv_key_2 to priv_key_3

        compressed = True

        exponent_3 = int("f8d39b8ecd0e1b6fee5a340519f239097569d7a403a50bb14fb2f04eff8db0ff", 16)
        bitcoin_address_3 = public_pair_to_bitcoin_address(
            ecdsa.public_pair_for_secret_exponent(ecdsa.generator_secp256k1, exponent_3), compressed=compressed
        )

        self.assertEqual("13zzEHPCH2WUZJzANymow3ZrxcZ8iFBrY5", bitcoin_address_3)

        coins_from = [(coinbase_spend_tx.hash(), 0, coinbase_spend_tx.txs_out[0])]
        unsigned_spend_tx = standard_tx(coins_from, [(int(50 * 1e8), bitcoin_address_3)])
        solver.update(build_hash160_lookup([exponent_2]))
        spend_tx = unsigned_spend_tx.sign(solver)

        # now check that it validates
        self.assertEqual(spend_tx.bad_signature_count(), 0)
开发者ID:mperklin,项目名称:pycoin,代码行数:57,代码来源:build_tx_test.py


示例2: test_sign

 def test_sign(self):
     sv = 33143560198659167577410026742586567991638126035902913554051654024377193788946
     tx_out_script = b'v\xa9\x14\x91\xb2K\xf9\xf5(\x852\x96\n\xc6\x87\xab\xb05\x12{\x1d(\xa5\x88\xac'
     st = script_obj_from_script(tx_out_script)
     hl = build_hash160_lookup([1])
     solution = st.solve(hash160_lookup=hl, sign_value=sv, signature_type=SIGHASH_ALL)
     self.assertEqual(solution, b'G0D\x02 ^=\xf5\xb5[\[email protected]\x04,"\x0b\x1f\xdf\x10\\\xc8Q\x13\xafV*!\\\x1f\xc5\xb5\xc5"\xd1\xb3\xd3\x02 8\xc9YK\x15o\xae\xd7\xf3|0\x07z\xff\xbfj\xcfB\xbf\x17\xb1\xe69\xa1\xfc\xc6\xc5\x1ag\xab\xa2\x16\x01A\x04y\xbef~\xf9\xdc\xbb\xacU\xa0b\x95\xce\x87\x0b\x07\x02\x9b\xfc\xdb-\xce(\xd9Y\xf2\x81[\x16\xf8\x17\x98H:\xdaw&\xa3\xc4e]\xa4\xfb\xfc\x0e\x11\x08\xa8\xfd\x17\xb4H\xa6\x85T\x19\x9cG\xd0\x8f\xfb\x10\xd4\xb8')
开发者ID:Bluejudy,项目名称:pycoin,代码行数:7,代码来源:pay_to_test.py


示例3: sign_tx

def sign_tx(certificate_metadata, last_input, allowable_wif_prefixes=None):
    """sign the transaction with private key"""
    with open(certificate_metadata.unsigned_tx_file_name, 'rb') as in_file:
        hextx = str(in_file.read(), 'utf-8')

        logging.info(
            'Signing tx with private key for recipient id: %s ...', certificate_metadata.uid)

        tx = Tx.from_hex(hextx)
        if allowable_wif_prefixes:
            wif = wif_to_secret_exponent(
                helpers.import_key(), allowable_wif_prefixes)
        else:
            wif = wif_to_secret_exponent(helpers.import_key())

        lookup = build_hash160_lookup([wif])

        tx.set_unspents(
            [TxOut(coin_value=last_input.amount, script=last_input.script_pub_key)])

        signed_tx = tx.sign(lookup)
        signed_hextx = signed_tx.as_hex()
        with open(certificate_metadata.unsent_tx_file_name, 'wb') as out_file:
            out_file.write(bytes(signed_hextx, 'utf-8'))

    logging.info('Finished signing transaction for certificate uid=%s',
                 certificate_metadata.uid)
开发者ID:Akiiki,项目名称:cert-issuer,代码行数:27,代码来源:create_certificates.py


示例4: sign_transaction

 def sign_transaction(self, wif, transaction_to_sign):
     secret_exponent = wif_to_secret_exponent(wif, self.allowable_wif_prefixes)
     lookup = build_hash160_lookup([secret_exponent])
     signed_transaction = transaction_to_sign.sign(lookup)
     # Because signing failures silently continue, first check that the inputs are signed
     for input in signed_transaction.txs_in:
         if len(input.script) == 0:
             logging.error('Unable to sign transaction. hextx=%s', signed_transaction.as_hex())
             raise UnableToSignTxError('Unable to sign transaction')
     return signed_transaction
开发者ID:NunoEdgarGub1,项目名称:cert-issuer,代码行数:10,代码来源:signer.py


示例5: sign_tx

def sign_tx(service, testnet, tx, keys):
    netcode = 'XTN' if testnet else 'BTC'
    secretexponents = list(map(lambda key: key.secret_exponent(), keys))
    lookup = build_hash160_lookup(secretexponents)
    for txin_idx in range(len(tx.txs_in)):
        txin = tx.txs_in[txin_idx]
        utxo_tx = service.get_tx(txin.previous_hash)
        script = utxo_tx.txs_out[txin.previous_index].script
        tx.sign_tx_in(lookup, txin_idx, script, SIGHASH_ALL, netcode=netcode)
    return tx
开发者ID:robertsdotpm,项目名称:btctxstore,代码行数:10,代码来源:control.py


示例6: get

 def get(self, v):
     if v in self.secret_exponent_db_cache:
         return self.secret_exponent_db_cache[v]
     for wif in self.wif_iterable:
         secret_exponent = wif_to_secret_exponent(wif, self.wif_prefix)
         d = build_hash160_lookup([secret_exponent])
         self.secret_exponent_db_cache.update(d)
         if v in self.secret_exponent_db_cache:
             return self.secret_exponent_db_cache[v]
     self.wif_iterable = []
     return None
开发者ID:superscud,项目名称:multisig-core,代码行数:11,代码来源:__init__.py


示例7: test_sign

 def test_sign(self):
     sv = 33143560198659167577410026742586567991638126035902913554051654024377193788946
     tx_out_script = b'v\xa9\x14\x91\xb2K\xf9\xf5(\x852\x96\n\xc6\x87\xab\xb05\x12{\x1d(\xa5\x88\xac'
     st = script_obj_from_script(tx_out_script)
     hl = build_hash160_lookup([1])
     solution = st.solve(hash160_lookup=hl, signature_for_hash_type_f=const_f(sv), signature_type=SIGHASH_ALL)
     self.assertEqual(
         solution, h2b(
             "47304402205e3df5b55be62140042c220b1fdf105cc85113af562a215c1fc5b5c522d1"
             "b3d3022038c9594b156faed7f37c30077affbf6acf42bf17b1e639a1fcc6c51a67aba2"
             "1601410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f817"
             "98483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"))
开发者ID:onestarshang,项目名称:pycoin,代码行数:12,代码来源:pay_to_test.py


示例8: multisig_N_of_M

 def multisig_N_of_M(self, N, M, unsigned_id, signed_id):
     keys = [Key(secret_exponent=i) for i in range(1, M+2)]
     tx_in = TxIn.coinbase_tx_in(script=b'')
     script = ScriptMultisig(n=N, sec_keys=[key.sec() for key in keys[:M]]).script()
     tx_out = TxOut(1000000, script)
     tx1 = Tx(version=1, txs_in=[tx_in], txs_out=[tx_out])
     tx2 = tx_utils.create_tx(tx1.tx_outs_as_spendable(), [keys[-1].address()])
     self.assertEqual(tx2.id(), unsigned_id)
     self.assertEqual(tx2.bad_signature_count(), 1)
     hash160_lookup = build_hash160_lookup(key.secret_exponent() for key in keys)
     tx2.sign(hash160_lookup=hash160_lookup)
     self.assertEqual(tx2.id(), signed_id)
     self.assertEqual(tx2.bad_signature_count(), 0)
开发者ID:Bluejudy,项目名称:pycoin,代码行数:13,代码来源:pay_to_test.py


示例9: multisig_M_of_N_individually

 def multisig_M_of_N_individually(self, M, N):
     keys = [Key(secret_exponent=i) for i in range(1, N+2)]
     tx_in = TxIn.coinbase_tx_in(script=b'')
     script = ScriptMultisig(n=M, sec_keys=[key.sec() for key in keys[:N]]).script()
     tx_out = TxOut(1000000, script)
     tx1 = Tx(version=1, txs_in=[tx_in], txs_out=[tx_out])
     for partial_key_list in itertools.permutations(keys[:N], M):
         tx2 = tx_utils.create_tx(tx1.tx_outs_as_spendable(), [keys[-1].address()])
         for key in partial_key_list:
             self.assertEqual(tx2.bad_signature_count(), 1)
             hash160_lookup = build_hash160_lookup([key.secret_exponent()])
             tx2.sign(hash160_lookup=hash160_lookup)
         self.assertEqual(tx2.bad_signature_count(), 0)
开发者ID:Stevengu999,项目名称:pycoin,代码行数:13,代码来源:pay_to_multisig.py


示例10: test_solve_pay_to_public_pair

 def test_solve_pay_to_public_pair(self):
     for se in range(1, 10):
         key = Key(secret_exponent=se)
         for b in [True, False]:
             addr = key.address(use_uncompressed=b)
             st = ScriptPayToPublicKey.from_key(key, use_uncompressed=b)
             self.assertEqual(st.address(), addr)
             hl = build_hash160_lookup([se])
             sv = 100
             solution = st.solve(hash160_lookup=hl, sign_value=sv, signature_type=SIGHASH_ALL)
             sc = st.script()
             st = script_obj_from_script(sc)
             self.assertEqual(st.address(), addr)
开发者ID:Bluejudy,项目名称:pycoin,代码行数:13,代码来源:pay_to_test.py


示例11: test_solve_pay_to_address

 def test_solve_pay_to_address(self):
     for se in range(1, 10):
         key = Key(secret_exponent=se)
         for b in [True, False]:
             addr = key.address(use_uncompressed=b)
             st = script_obj_from_address(addr)
             self.assertEqual(st.address(), addr)
             hl = build_hash160_lookup([se])
             sv = 100
             solution = st.solve(hash160_lookup=hl, signature_for_hash_type_f=const_f(sv), signature_type=SIGHASH_ALL)
             sc = st.script()
             st = script_obj_from_script(sc)
             self.assertEqual(st.address(), addr)
开发者ID:Stevengu999,项目名称:pycoin,代码行数:13,代码来源:pay_to_test.py


示例12: test_sign_pay_to_script_multisig

 def test_sign_pay_to_script_multisig(self):
     N, M = 3, 3
     keys = [Key(secret_exponent=i) for i in range(1, M+2)]
     tx_in = TxIn.coinbase_tx_in(script=b'')
     underlying_script = ScriptMultisig(n=N, sec_keys=[key.sec() for key in keys[:M]]).script()
     address = address_for_pay_to_script(underlying_script)
     self.assertEqual(address, "39qEwuwyb2cAX38MFtrNzvq3KV9hSNov3q")
     script = standard_tx_out_script(address)
     tx_out = TxOut(1000000, script)
     tx1 = Tx(version=1, txs_in=[tx_in], txs_out=[tx_out])
     tx2 = tx_utils.create_tx(tx1.tx_outs_as_spendable(), [address])
     hash160_lookup = build_hash160_lookup(key.secret_exponent() for key in keys[:M])
     p2sh_lookup = build_p2sh_lookup([underlying_script])
     tx2.sign(hash160_lookup=hash160_lookup, p2sh_lookup=p2sh_lookup)
     self.assertEqual(tx2.bad_signature_count(), 0)
开发者ID:Bluejudy,项目名称:pycoin,代码行数:15,代码来源:pay_to_test.py


示例13: sign_tx

def sign_tx(hex_tx, tx_input):
    """
    Sign the transaction with private key
    :param hex_tx:
    :param tx_input:
    :return:
    """
    logging.info('Signing tx with private key')
    transaction = Tx.from_hex(hex_tx)
    wif = wif_to_secret_exponent(helpers.import_key(), ALLOWABLE_WIF_PREFIXES)
    lookup = build_hash160_lookup([wif])
    transaction.set_unspents([TxOut(coin_value=tx_input.coin_value, script=tx_input.script)])
    signed_tx = transaction.sign(lookup)
    logging.info('Finished signing transaction')
    return signed_tx
开发者ID:digital-certificates,项目名称:cert-issuer,代码行数:15,代码来源:trx_utils.py


示例14: test_sign_bitcoind_partially_signed_2_of_2

 def test_sign_bitcoind_partially_signed_2_of_2(self):
     # Finish signing a 2 of 2 transaction, that already has one signature signed by bitcoind
     # This tx can be found on testnet3 blockchain, txid: 9618820d7037d2f32db798c92665231cd4599326f5bd99cb59d0b723be2a13a2
     raw_script = "522103e33b41f5ed67a77d4c4c54b3e946bd30d15b8f66e42cb29fde059c16885116552102b92cb20a9fb1eb9656a74eeb7387636cf64cdf502ff50511830328c1b479986452ae"
     p2sh_lookup = build_p2sh_lookup([h2b(raw_script)])
     partially_signed_raw_tx = "010000000196238f11a5fd3ceef4efd5a186a7e6b9217d900418e72aca917cd6a6e634e74100000000910047304402201b41b471d9dd93cf97eed7cfc39a5767a546f6bfbf3e0c91ff9ad23ab9770f1f02205ce565666271d055be1f25a7e52e34cbf659f6c70770ff59bd783a6fcd1be3dd0147522103e33b41f5ed67a77d4c4c54b3e946bd30d15b8f66e42cb29fde059c16885116552102b92cb20a9fb1eb9656a74eeb7387636cf64cdf502ff50511830328c1b479986452aeffffffff01a0bb0d00000000001976a9143b3beefd6f7802fa8706983a76a51467bfa36f8b88ac00000000"
     tx = Tx.from_hex(partially_signed_raw_tx)
     tx_out = TxOut(1000000, h2b("a914a10dfa21ee8c33b028b92562f6fe04e60563d3c087"))
     tx.set_unspents([tx_out])
     key = Key.from_text("cThRBRu2jAeshWL3sH3qbqdq9f4jDiDbd1SVz4qjTZD2xL1pdbsx")
     hash160_lookup = build_hash160_lookup([key.secret_exponent()])
     self.assertEqual(tx.bad_signature_count(), 1)
     tx.sign(hash160_lookup=hash160_lookup, p2sh_lookup=p2sh_lookup)
     self.assertEqual(tx.bad_signature_count(), 0)
     self.assertEqual(tx.id(), "9618820d7037d2f32db798c92665231cd4599326f5bd99cb59d0b723be2a13a2")
开发者ID:Stevengu999,项目名称:pycoin,代码行数:15,代码来源:pay_to_test.py


示例15: sign_tx

def sign_tx(tx, utxo_list, is_test):
    secret_exponents = [utxo.address_rec.rawPrivKey
                        for utxo in utxo_list if utxo.address_rec]
    hash160_lookup = build_hash160_lookup(secret_exponents)
    txins = tx.txs_in[:]
    for txin_idx in xrange(len(txins)):
        blank_txin = txins[txin_idx]
        utxo = None
        for utxo_candidate in utxo_list:
            if utxo_candidate.get_txhash() == blank_txin.previous_hash \
                    and utxo_candidate.outindex == blank_txin.previous_index:
                utxo = utxo_candidate
                break
        if not (utxo and utxo.address_rec):
            continue
        txout_script = utxo.script.decode('hex')
        tx.sign_tx_in(hash160_lookup, txin_idx, txout_script, SIGHASH_ALL)
开发者ID:F483,项目名称:ngcccbase,代码行数:17,代码来源:pycoin_txcons.py


示例16: test_multisig_one_at_a_time

 def test_multisig_one_at_a_time(self):
     N = 3
     M = 3
     keys = [Key(secret_exponent=i) for i in range(1, M+2)]
     tx_in = TxIn.coinbase_tx_in(script=b'')
     script = ScriptMultisig(n=N, sec_keys=[key.sec() for key in keys[:M]]).script()
     tx_out = TxOut(1000000, script)
     tx1 = Tx(version=1, txs_in=[tx_in], txs_out=[tx_out])
     tx2 = tx_utils.create_tx(tx1.tx_outs_as_spendable(), [keys[-1].address()])
     ids = ["403e5bfc59e097bb197bf77a692d158dd3a4f7affb4a1fa41072dafe7bec7058",
            "5931d9995e83721243dca24772d7012afcd4378996a8b953c458175f15a544db",
            "9bb4421088190bbbb5b42a9eaa9baed7ec7574a407c25f71992ba56ca43d9c44",
            "03a1dc2a63f93a5cf5a7cb668658eb3fc2eda88c06dc287b85ba3e6aff751771"]
     for i in range(1, M+1):
         self.assertEqual(tx2.bad_signature_count(), 1)
         self.assertEqual(tx2.id(), ids[i-1])
         hash160_lookup = build_hash160_lookup(key.secret_exponent() for key in keys[i-1:i])
         tx2.sign(hash160_lookup=hash160_lookup)
         self.assertEqual(tx2.id(), ids[i])
     self.assertEqual(tx2.bad_signature_count(), 0)
开发者ID:Bluejudy,项目名称:pycoin,代码行数:20,代码来源:pay_to_test.py


示例17: createTransaction

	def createTransaction (self, outs, fee):
		# Create the signed transaction
		spendables = self._spendables (int (fee))

		#print (spendables)
		if len (spendables) == 0:
			logger.error ('No spendables available')
			return None

		t = create_tx(spendables, [self.address], fee=int (fee))

		for o in outs:
			t.txs_out.append (TxOut (0.0, tools.compile (o)))

		secret_exponent = wif_to_secret_exponent(self.wif, allowable_wif_prefixes=[wif_prefix_for_netcode (self.chain)])
		d = {}
		d.update (build_hash160_lookup([secret_exponent]))

		t.sign (d)
		txhash = (t.as_hex ())
		return txhash
开发者ID:contractvm,项目名称:libcontractvm,代码行数:21,代码来源:Wallet.py


示例18: createTransaction

    def createTransaction(self, address, amount, keychain, fee="standard",
                          confirms=0):
        unspents_result = yield self.unspents()
        spendables = []
        p2sh = []
        chain_paths = []
        # Strip leading /
        keychain_path = keychain['path'][1:]
        for unspent in unspents_result["unspents"]:
            if unspent["confirmations"] < confirms:
                continue
            p2sh.append(h2b(unspent["redeemScript"]))
            spendable = Spendable(unspent["value"],
                                  h2b(unspent["script"]),
                                  h2b_rev(unspent["tx_hash"]),
                                  unspent["tx_output_n"])
            spendables.append(spendable)
            chain_paths.append(keychain_path + unspent['chainPath'])
        p2sh_lookup = build_p2sh_lookup(p2sh)
        address_result = yield self.createAddress(1)
        change = address_result["address"]
        tx = tx_utils.create_tx(spendables, [(address, amount), change], fee)

        # address_keys = [BIP32Node.from_hwif(keychain["xprv"]).subkey_for_path("0/0/0/0"),
        #                 BIP32Node.from_hwif(keychain["xprv"]).subkey_for_path(address_result['path'])]

        spendable_keys = [BIP32Node.from_hwif(keychain["xprv"]).subkey_for_path(path) for path in chain_paths]
        # all_keys = address_keys + spendable_keys

        hash160_lookup = build_hash160_lookup([key.secret_exponent() for key in spendable_keys])

        pprint(tx)

        tx.sign(hash160_lookup=hash160_lookup, p2sh_lookup=p2sh_lookup)

        pprint(tx)

        returnValue({'tx': tx.as_hex(),
                     'fee': tx.fee()})
开发者ID:faheem-cliqz,项目名称:bitgo,代码行数:39,代码来源:bitgo.py


示例19: publish_data

def publish_data(data, unused_utxo):
  data = POE_MARKER_BYTES + data
  if len(data) > OP_RETURN_MAX_DATA:
    msg='data too long for OP_RETURN: %s' % (data.encode('hex'))
    ErrorNotification.new(msg)  
    return None, msg

  _from = unused_utxo.address
  _private_key=PAYMENT_OBJ[_from][0]
  secret_exponent = wif_to_secret_exponent(_private_key) #mainnet
  
  unsigned_tx = construct_data_tx(data, _from, unused_utxo)
  
  if type(unsigned_tx) == str: # error
    msg='ERROR: type(unsigned_tx) == str'
    ErrorNotification.new(msg) 
    return (None, unsigned_tx)

  solver = build_hash160_lookup([secret_exponent])  
  signed_tx = unsigned_tx.sign(solver) 
  raw_tx = tx2hex(signed_tx)
  
  txid, message = pushtxn(raw_tx)
  return txid, message
开发者ID:Udala,项目名称:docforever,代码行数:24,代码来源:blockchain.py


示例20: print

for i in subBip32PrivateNodes:
    print(i)

print("")

"""
# beginning part totally signed
hash160_lookup = build_hash160_lookup([subBip32PrivateNodes[i].secret_exponent() for i in range(len(subBip32PrivateNodes))])
# >>> [subBip32PrivateNodes[i].secret_exponent() for i in range(len(subBip32PrivateNodes))]
# [110380562092968897127842430006032843930864261596730345665503170493711194530512, 73231854494958203118397405284330291107828238186602400029170683163884922382627]
p2sh_lookup = build_p2sh_lookup([script_encoded])
p2sh_lookup = build_p2sh_lookup([script_encoded])
tx.sign(hash160_lookup=hash160_lookup, p2sh_lookup=p2sh_lookup)
tx.bad_signature_count() # checking if the signature process has worked
tx.as_hex() # is the raw hex correctly signed transaction
# 01000000020076ae0b7d8b4b7b44ac0b2fe2d5dc67aabbf0898291f190c7f9004f3923744301000000fc0047304402206fa07cce3d3c76dfb837c06bea796cb5b15e9075be6f20c708175662b3439c840220110fdc96c589ccaaf019e0678efd9aa2770661fb9f61227fb34b283a433b29110147304402207fb7f368d9458dd4d5afdf2ba89f42e5420634418759cdc8438f6ece60494b9d02203efe6428ec53bd08665300470f5e21f80f37fdb131281810f3b539d8268371e7014c695221033cb2f8b318f4c14e42cbe20cb365b2017d28bc557b0dde9eca2fbe8d3c9ed1982102e680e729a24923c09db6f958363b0416bc13970008ab7b925b2f2aa410e6b0a72102208fa0a00d6b9ae56f7cc137a021d03ae294d39242d64322f69bdc785853ba6453aeffffffffbbedb48aacb4dcea45687631cf592035843e754f603f7615b590d2b2f12e858d00000000fdfe0000483045022100f3a6e2cac3ffd51c85bfa0162d60ab125d669bb31b735563b8b4f47cf9fd7495022019f9a668d4c984e1da7f9ff16321bed57df66f7a80a953cc798682204b91e4f301483045022100c6d9226dccee03fcd9539db6780e0c9af1e096b260e4b60852c4ba1c2d1c9810022061bfa26cb8984aac054d6525cb7aeb9ce2d77021233e15928c2668de60848704014c695221033cb2f8b318f4c14e42cbe20cb365b2017d28bc557b0dde9eca2fbe8d3c9ed1982102e680e729a24923c09db6f958363b0416bc13970008ab7b925b2f2aa410e6b0a72102208fa0a00d6b9ae56f7cc137a021d03ae294d39242d64322f69bdc785853ba6453aeffffffff01803801000000000017a914b2f5e0dfcfa103a0fb4208c3393c30ff3204b5d78700000000

# end part totally signed
"""
# To sign the transaction for cryptocorp I will sign with just one of the two private keys required let's choose the first.

hash160_lookup = build_hash160_lookup([subBip32PrivateNodes[0].secret_exponent()])
p2sh_lookup = build_p2sh_lookup([script_encoded])
tx2.sign(hash160_lookup=hash160_lookup, p2sh_lookup=p2sh_lookup)
tx2.bad_signature_count()
tx2.as_hex() # is the raw hex of the totally signed transaction
print(tx.as_hex())
print("")
print("N. bad signatures: %s" % tx.bad_signature_count() )

开发者ID:gabridome,项目名称:cryptocorp,代码行数:29,代码来源:send_with_pycoin.py



注:本文中的pycoin.tx.pay_to.build_hash160_lookup函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tools.compile函数代码示例发布时间:2022-05-25
下一篇:
Python Tx.Tx类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap