2.3. Transactions#

The Transactions class is available in all explorers.

2.3.1. Sync Usage#

from bloxplorer import bitcoin_explorer as explorer

result = explorer.tx.get('f29e151e71db58ade22be066afafdc59ed7df8195e3944a5e577b275dc37bf94')
print(result.data)

2.3.2. Async Usage#

from bloxplorer import async_bitcoin_explorer as async_explorer

result = await async_explorer.tx.get('f29e151e71db58ade22be066afafdc59ed7df8195e3944a5e577b275dc37bf94')
print(result.data)

2.3.3. Result#

Both usages will output the same result data. Example output:

"""
{
    'txid': '42d7717a80ade0b1f12481a392def5521254f2da243f4e88a850aa7e3fc3c017',
    'version': 1,
    'locktime': 0,
    'vin': [
        {
            'txid': '6d84e0715d6d729c891bf77bf7b758c329b415c5faff423ba95b6f5ba7c8449c',
            'vout': 0,
            'prevout': {
                'scriptpubkey': '001440c6676b80f6df036c18af0678b2bcbba029407f',
                'scriptpubkey_asm': 'OP_0 OP_PUSHBYTES_20 40c6676b80f6df036c18af0678b2bcbba029407f',
                'scriptpubkey_type': 'v0_p2wpkh',
                'scriptpubkey_address': 'bc1qgrrxw6uq7m0sxmqc4ur83v4uhwszjsrlpe9hwm',
                'value': 473862
            },
        'scriptsig': '',
        'scriptsig_asm': '',
        'witness': [
            '3045022100a4f3567101168da5b96d6b9f89a206ef297eb87e993da0c2563b50fce42abfd70220655c90f59fe0b9b5db331fe327ec466d7e97de5ca9b97b4e8fc8330f003c4fe901',
            '036081cb5819b0e98d9d28319d83e6e67de21a529202e9b6465b7992053b422521'
        ],
        'is_coinbase': False,
        'sequence': 4294967295
    }
],
'vout': [
    {
        'scriptpubkey': '0014ca95888d9d192b22b0bdc8d8755412d24c30f02d',
        'scriptpubkey_asm': 'OP_0 OP_PUSHBYTES_20 ca95888d9d192b22b0bdc8d8755412d24c30f02d',
        'scriptpubkey_type': 'v0_p2wpkh',
        'scriptpubkey_address': 'bc1qe22c3rvary4j9v9aerv824qj6fxrpupdlyqp4r',
        'value': 106489
    },
    {
        'scriptpubkey': '0014173215f2ff25ec479498ef2d6ad60419837b0234',
        'scriptpubkey_asm': 'OP_0 OP_PUSHBYTES_20 173215f2ff25ec479498ef2d6ad60419837b0234',
        'scriptpubkey_type': 'v0_p2wpkh',
        'scriptpubkey_address': 'bc1qzueptuhlyhky09ycaukk44syrxphkq35pt65w5',
        'value': 364976
    }
],
'size': 223,
'weight': 562,
'fee': 2397,
'status': {
    'confirmed': True,
    'block_height': 921775,
    'block_hash': '000000000000000000010b6ed9d2333c0797ab02f244ad2adc8734fdf6cd03de',
    'block_time': 1762016765
}}
"""

2.3.4. Available methods#

class bloxplorer.transactions.SyncTransactions(*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.