美文网首页
bitcoin rpc api: gettransaction

bitcoin rpc api: gettransaction

作者: 已不再更新_转移到qiita | 来源:发表于2017-11-14 10:55 被阅读67次
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