本文整理汇总了Python中pycoin.tx.Tx.Tx.confirmation_block_hash方法的典型用法代码示例。如果您正苦于以下问题:Python Tx.confirmation_block_hash方法的具体用法?Python Tx.confirmation_block_hash怎么用?Python Tx.confirmation_block_hash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pycoin.tx.Tx.Tx
的用法示例。
在下文中一共展示了Tx.confirmation_block_hash方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: tx_from_json_dict
# 需要导入模块: from pycoin.tx.Tx import Tx [as 别名]
# 或者: from pycoin.tx.Tx.Tx import confirmation_block_hash [as 别名]
def tx_from_json_dict(r):
version = r.get("version")
lock_time = r.get("locktime")
txs_in = []
for vin in r.get("vin"):
if "coinbase" in vin:
previous_hash = b'\0' * 32
script = h2b(vin.get("coinbase"))
previous_index = 4294967295
else:
previous_hash = h2b_rev(vin.get("txid"))
scriptSig = vin.get("scriptSig")
if "hex" in scriptSig:
script = h2b(scriptSig.get("hex"))
else:
script = tools.compile(scriptSig.get("asm"))
previous_index = vin.get("vout")
sequence = vin.get("sequence")
txs_in.append(TxIn(previous_hash, previous_index, script, sequence))
txs_out = []
for vout in r.get("vout"):
coin_value = btc_to_satoshi(decimal.Decimal(vout.get("value")))
script = tools.compile(vout.get("scriptPubKey").get("asm"))
txs_out.append(TxOut(coin_value, script))
tx = Tx(version, txs_in, txs_out, lock_time)
bh = r.get("blockhash")
if bh:
bh = h2b_rev(bh)
tx.confirmation_block_hash = bh
return tx