bitcoin rpc api: gettransaction
def calc_coinbase_tx_amount(node, blockhash):
block = node.getblock(blockhash)
coinbase_tx = block['tx'][0]
tx_detail = node.gettransaction(coinbase_tx) # 只能获取自己钱包的数据
amount = tx_detail['details'][0]['amount']
return amount
def calc_coinbase_tx_amount(node, blockhash):
block = node.getblock(blockhash)
coinbase_tx = block['tx'][0]
raw_tx = node.getrawtransaction(coinbase_tx) # 能获取所有的数据
result = node.decoderawtransaction(raw_tx)
vouts = result['vout']
amount = 0
for vout in vouts:
amount += vout['value']
return amount
本文标题:bitcoin rpc api: gettransaction
本文链接:https://www.haomeiwen.com/subject/psyxvxtx.html
网友评论