2.3. Transactions

The Transactions class is available in all explorers.

2.3.1. Usage

from bloxplorer import bitcoin_testnet_explorer as explorer

result = explorer.tx.get('6d0139c3d0f529dda57496f1eabf0b32c9296c93b49b7a4965fa5ad91be4f216')
print(result.data)

"""
{
    'txid': '6d0139c3d0f529dda57496f1eabf0b32c9296c93b49b7a4965fa5ad91be4f216',
    'version': 2,
    'locktime': 0,
    'vin': [
        {
        'txid': '0000000000000000000000000000000000000000000000000000000000000000',
        'vout': 4294967295,
        'prevout': null,
        'scriptsig': '03cffd170454c6445d44434578706c6f726174696f6e09000fdddd13000000000000',
        'scriptsig_asm': 'OP_PUSHBYTES_3 cffd17 OP_PUSHBYTES_4 54c6445d OP_PUSHBYTES_68 <push past end>',
        'witness': [
            '0000000000000000000000000000000000000000000000000000000000000000'
        ],
        'is_coinbase': true,
        'sequence': 4294967295
        }
    ],
    'vout': [
        {
        'scriptpubkey': 'a914e0725ef08b0046fd2df3c58d5fefc5580e1f59de87',
        'scriptpubkey_asm': 'OP_HASH160 OP_PUSHBYTES_20 e0725ef08b0046fd2df3c58d5fefc5580e1f59de OP_EQUAL',
        'scriptpubkey_type': 'p2sh',
        'scriptpubkey_address': '2NDhzMt2D9ZxXapbuq567WGeWP7NuDN81cg',
        'value': 39218600
        },
        {
        'scriptpubkey': '6a24aa21a9ede772884776c199b25a5019a413713737c23c0d3e3d71e75aac7ac43b3df059ec',
        'scriptpubkey_asm': 'OP_RETURN OP_PUSHBYTES_36 aa21a9ede772884776c199b25a5019a413713737c23c0d3e3d71e75aac7ac43b3df059ec',
        'scriptpubkey_type': 'op_return',
        'value': 0
        }
    ],
    'size': 200,
    'weight': 692,
    'status': {
        'confirmed': true,
        'block_height': 1572303,
        'block_hash': '00000000000001decd01ced9b0b98f15ffb600f6abd27e0634809a90268b3765',
        'block_time': 1564788341
    }
    }
"""
class bloxplorer.transactions.Transactions(*args, **kwargs)

Wrapper class around the Esplora Transactions endpoint.

Blockstream Esplora Transactions API Docs

get(tx_id, **kwargs)

Returns information about the transaction.

Parameters
  • tx_id – String representing the transaction hash.

  • **kwargs – (Optional) Arguments that Requests takes.

Returns

class

Response object.

get_hex(tx_id, **kwargs)

Returns the transaction in hex.

Parameters
  • tx_id – String representing the transaction hash.

  • **kwargs – (Optional) Arguments that Requests takes.

Returns

class

Response object.

get_merkle_proof(tx_id, **kwargs)

Returns a merkle inclusion proof for the transaction using Electrum’s blockchain.transaction.get_merkle format.

Parameters
  • tx_id – String representing the transaction hash.

  • **kwargs – (Optional) Arguments that Requests takes.

Returns

class

Response object.

get_merkleblock_proof(tx_id, **kwargs)

Returns a merkle inclusion proof for the transaction using bitcoind’s merkleblock format.

Note: This endpoint is not currently available for Liquid/Elements-based chains.

Parameters
  • tx_id – String representing the transaction hash.

  • **kwargs – (Optional) Arguments that Requests takes.

Returns

class

Response object.

get_raw(tx_id, **kwargs)

Returns the transaction as binary data.

Parameters
  • tx_id – String representing the transaction hash.

  • **kwargs – (Optional) Arguments that Requests takes.

Returns

class

Response object.

get_spending_status(tx_id, vout=None, **kwargs)

Returns the spending status of all transaction outputs. If vout is present, return the status of the transaction output located at that index.

Parameters
  • tx_id – String representing the transaction hash.

  • vout – (Optional) Integer representing the index of the transaction output.

  • **kwargs – (Optional) Arguments that Requests takes.

Returns

class

Response object.

get_status(tx_id, **kwargs)

Returns the transaction confirmation status

Parameters
  • tx_id – String representing the transaction hash.

  • **kwargs – (Optional) Arguments that Requests takes.

Returns

class

Response object.

post(hex_tx, **kwargs)

Broadcast a raw transaction to the network. The transaction should be provided as hex in the request body. The tx_id will be returned as data on success.

Parameters
  • hex_tx – The transaction hex.

  • **kwargs – (Optional) Arguments that Requests takes.

Returns

class

Response object.