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

Python mininode.CTransaction类代码示例

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

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



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

示例1: mine_and_test_listunspent

 def mine_and_test_listunspent(self, script_list, ismine):
     utxo = find_spendable_utxo(self.nodes[0], 50)
     tx = CTransaction()
     tx.vin.append(CTxIn(COutPoint(int('0x'+utxo['txid'],0), utxo['vout'])))
     for i in script_list:
         tx.vout.append(CTxOut(10000000, i))
     tx.rehash()
     signresults = self.nodes[0].signrawtransactionwithwallet(bytes_to_hex_str(tx.serialize_without_witness()))['hex']
     txid = self.nodes[0].sendrawtransaction(signresults, True)
     self.nodes[0].generate(1)
     sync_blocks(self.nodes)
     watchcount = 0
     spendcount = 0
     for i in self.nodes[0].listunspent():
         if (i['txid'] == txid):
             watchcount += 1
             if (i['spendable'] == True):
                 spendcount += 1
     if (ismine == 2):
         assert_equal(spendcount, len(script_list))
     elif (ismine == 1):
         assert_equal(watchcount, len(script_list))
         assert_equal(spendcount, 0)
     else:
         assert_equal(watchcount, 0)
     return txid
开发者ID:994920256,项目名称:bitcoin,代码行数:26,代码来源:feature_segwit.py


示例2: sign_transaction

 def sign_transaction(self, node, unsignedtx):
     rawtx = ToHex(unsignedtx)
     signresult = node.signrawtransaction(rawtx)
     tx = CTransaction()
     f = BytesIO(hex_str_to_bytes(signresult['hex']))
     tx.deserialize(f)
     return tx
开发者ID:admxjx,项目名称:bitcoin,代码行数:7,代码来源:bip68-112-113-p2p.py


示例3: mine_and_test_listunspent

 def mine_and_test_listunspent(self, script_list, ismine):
     utxo = find_unspent(self.nodes[0], 50)
     tx = CTransaction()
     tx.vin.append(CTxIn(COutPoint(int("0x" + utxo["txid"], 0), utxo["vout"])))
     for i in script_list:
         tx.vout.append(CTxOut(10000000, i))
     tx.rehash()
     signresults = self.nodes[0].signrawtransaction(bytes_to_hex_str(tx.serialize_without_witness()))["hex"]
     txid = self.nodes[0].sendrawtransaction(signresults, True)
     self.nodes[0].generate(1)
     sync_blocks(self.nodes)
     watchcount = 0
     spendcount = 0
     for i in self.nodes[0].listunspent():
         if i["txid"] == txid:
             watchcount += 1
             if i["spendable"] == True:
                 spendcount += 1
     if ismine == 2:
         assert_equal(spendcount, len(script_list))
     elif ismine == 1:
         assert_equal(watchcount, len(script_list))
         assert_equal(spendcount, 0)
     else:
         assert_equal(watchcount, 0)
     return txid
开发者ID:sebrandon1,项目名称:bitcoin,代码行数:26,代码来源:segwit.py


示例4: sign_transaction

 def sign_transaction(self, node, unsignedtx):
     rawtx = ToHex(unsignedtx)
     signresult = node.signrawtransaction(rawtx)
     tx = CTransaction()
     f = cStringIO.StringIO(unhexlify(signresult['hex']))
     tx.deserialize(f)
     return tx
开发者ID:dagurval,项目名称:bitcoinxt,代码行数:7,代码来源:bip68-112-113-p2p.py


示例5: sign_transaction

 def sign_transaction(self, node, unsignedtx):
     rawtx = ToHex(unsignedtx)
     signresult = node.signrawtransaction(rawtx)
     tx = CTransaction()
     f = BytesIO(unhexlify(signresult["hex"]))
     tx.deserialize(f)
     return tx
开发者ID:jessezwd,项目名称:bitcoin,代码行数:7,代码来源:bip68-112-113-p2p.py


示例6: create_transaction

 def create_transaction(self, node, txid, to_address, amount):
     inputs = [{ "txid" : txid, "vout" : 0}]
     outputs = { to_address : amount }
     rawtx = node.createrawtransaction(inputs, outputs)
     tx = CTransaction()
     f = BytesIO(hex_str_to_bytes(rawtx))
     tx.deserialize(f)
     return tx
开发者ID:admxjx,项目名称:bitcoin,代码行数:8,代码来源:bip68-112-113-p2p.py


示例7: create_transaction

 def create_transaction(self, node, txid, to_address, amount):
     inputs = [{ "txid" : txid, "vout" : 0}]
     outputs = { to_address : amount }
     rawtx = node.createrawtransaction(inputs, outputs)
     tx = CTransaction()
     f = cStringIO.StringIO(unhexlify(rawtx))
     tx.deserialize(f)
     return tx
开发者ID:dagurval,项目名称:bitcoinxt,代码行数:8,代码来源:bip68-112-113-p2p.py


示例8: create_transaction

 def create_transaction(self, node, txid, to_address, amount):
     inputs = [{"txid": txid, "vout": 0}]
     outputs = {to_address: amount}
     rawtx = node.createrawtransaction(inputs, outputs)
     signresult = node.signrawtransaction(rawtx, None, None, "ALL|FORKID")
     tx = CTransaction()
     f = BytesIO(hex_str_to_bytes(signresult['hex']))
     tx.deserialize(f)
     return tx
开发者ID:CommerciumBlockchain,项目名称:Commercium_Deprecated,代码行数:9,代码来源:nulldummy.py


示例9: create_transaction

 def create_transaction(self, node, coinbase, to_address, amount):
     from_txid = node.getblock(coinbase)['tx'][0]
     inputs = [{ "txid" : from_txid, "vout" : 0}]
     outputs = { to_address : amount }
     rawtx = node.createrawtransaction(inputs, outputs)
     tx = CTransaction()
     f = cStringIO.StringIO(unhexlify(rawtx))
     tx.deserialize(f)
     tx.nVersion = 2
     return tx
开发者ID:KrzysiekJ,项目名称:bitcoinxt,代码行数:10,代码来源:bip9-softforks.py


示例10: submit_block_with_tx

def submit_block_with_tx(node, tx):
    ctx = CTransaction()
    ctx.deserialize(io.BytesIO(hex_str_to_bytes(tx)))

    tip = node.getbestblockhash()
    height = node.getblockcount() + 1
    block_time = node.getblockheader(tip)["mediantime"] + 1
    block = blocktools.create_block(int(tip, 16), blocktools.create_coinbase(height), block_time)
    block.vtx.append(ctx)
    block.rehash()
    block.hashMerkleRoot = block.calc_merkle_root()
    block.solve()
    node.submitblock(bytes_to_hex_str(block.serialize(True)), '', True)
    return block
开发者ID:youngmou,项目名称:BitcoinX,代码行数:14,代码来源:bumpfee.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python script.hash160函数代码示例发布时间:2022-05-27
下一篇:
Python mininode.sha256函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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