Exemplo n.º 1
0
 def get_chain_txns_status(txn_hashes):
     if not isinstance(txn_hashes, list):
         raise Exception("txn_hashes must be a list of txn hashes, even if it just contains one hash")
     results = []
     for tx_hash in txn_hashes:
         tx_info = blockchain.gettransaction(tx_hash)
         if tx_info:
             assert tx_info['txid'] == tx_hash
             results.append({
                 'tx_hash': tx_info['txid'],
                 'blockhash': tx_info.get('blockhash', None), #not provided if not confirmed on network
                 'confirmations': tx_info.get('confirmations', 0), #not provided if not confirmed on network
                 'blocktime': tx_info.get('time', None),
             })
     return results
Exemplo n.º 2
0
 def get_script_pub_key(tx_hash, vout_index):
     tx = blockchain.gettransaction(tx_hash)
     if tx is not None and 'vout' in tx and len(tx['vout']) > vout_index:
         return tx['vout'][vout_index]
     return None
Exemplo n.º 3
0
 def get_script_pub_key(tx_hash, vout_index):
     tx = blockchain.gettransaction(tx_hash)
     if 'vout' in tx and len(tx['vout']) > vout_index:
       return tx['vout'][vout_index]
     return None