Transaction

Get by Transaction Hash

This endpoint retrieves the transaction details for a given transaction ID.

circle-info
  • In the response body, if any output's hex size vout[x].scriptPubKey.hex exceeds 100KB, then the data for vout[x].scriptPubKey.hex and vout[x].scriptPubKey.asm is truncated and a flag vout[x].scriptPubKey.isTruncated is set to true.

  • For unconfirmed transactions, blockhash and confirmations info won't be returned, as it doesn't exist.

  • A separate endpoint Get Raw Transaction Output Data can be used to fetch the full hex data, if required by the client application.

HTTP Request

GET https://api.whatsonchain.com/v1/bsv/<network>/tx/hash/<txid>

Example Request

curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/tx/c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96"

Example Response

{
    "txid": "c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96",
    "hash": "c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96",
    "version": 1,
    "size": 113,
    "locktime": 0,
    "vin": [{
        "coinbase": "03d7c6082f7376706f6f6c2e636f6d2f3edff034600055b8467f0040",
        "txid": "",
        "vout": 0,
        "scriptSig": {
            "asm": "",
            "hex": ""
        },
        "sequence": 4294967295
    }],
    "vout": [{
        "value": 12.5000042,
        "n": 0,
        "scriptPubKey": {
            "asm": "OP_DUP OP_HASH160 492558fb8ca71a3591316d095afc0f20ef7d42f7 OP_EQUALVERIFY OP_CHECKSIG",
            "hex": "76a914492558fb8ca71a3591316d095afc0f20ef7d42f788ac",
            "reqSigs": 1,
            "type": "pubkeyhash",
            "addresses": ["17fm4xevwDh3XRHv9UoqYrVgPMbwcGHsUs"],
            "isTruncated": false
        }
    }],
    "blockhash": "0000000000000000091216c46973d82db057a6f9911352892b7769ed517681c3",
    "confirmations": 329877,
    "time": 1553501874,
    "blocktime": 1553501874,
    "blockheight": 575191
}

URL Parameters

Parameter
Description

chain

Desired blockchain: bsv or btc.

network

Selected network: main or test.

txid

Transaction ID.

Get by Transaction Index (BSV-only)

This endpoint retrieves the transaction details for a given block height and transaction index in that block. Works only for confirmed transactions.

circle-info
  • In the response body, if any output's hex size vout[x].scriptPubKey.hex exceeds 100KB, then the data for vout[x].scriptPubKey.hex and vout[x].scriptPubKey.asm is truncated and a flag vout[x].scriptPubKey.isTruncated is set to true.

  • A separate endpoint Get Raw Transaction Output Data can be used to fetch the full hex data, if required by the client application.

URL Parameters

Parameter
Description

network

Selected network: main or test.

height

Specified block height.

txindex

Index of the transaction in the associated block.

Get Transaction Propagation Status (BSV-only)

This endpoint returns the propagation status for a given transaction. It queries a random set of peers on the network and returns the number of peers that have the transaction in question.

circle-exclamation
circle-info

If the transaction has been found on zero peers, possible reasons may include:

  • Propagation is still in progress;

  • The transaction fee rate, or that of a preceding transaction, is relatively low, making it invisible to peers that are configured to accept only higher fee rates.

URL Parameters

Parameter
Description

network

The selected network: main or test.

txid

Transaction ID.

Broadcast Transaction (BSV-only)

You can broadcast a transaction to the BSV network using this endpoint. Returns the txid in the response or an error message from the node, with header content-type: text/plain.

circle-exclamation

URL Parameters

Parameter
Description

network

Selected network: main or test.

Request Parameters

Parameter
Description

txhex

Raw transaction data in hex.

Bulk Transaction Details

You can fetch details for multiple transactions in a single request.

circle-info
  • Max 20 transactions per request.

  • For unconfirmed transactions, blockhash and confirmations info won't be returned, as it doesn't exist.

Example Request

Example Response

URL Parameters

Parameter
Description

chain

Desired blockchain: bsv or btc.

network

Selected network: main or test.

Bulk Transaction Status

You can get the status of multiple transactions in a single request.

circle-info

Max 20 transactions per request.

Example Request

Example Response

URL Parameters

Parameter
Description

chain

Desired blockchain: bsv or btc.

network

Selected network: main or test.

Decode Transaction

You can decode a raw transaction using this endpoint. Returns a json in response or an error message from the node.

Example Request

Example Response

URL Parameters

Parameter
Description

network

Selected network: main or test.

Request Parameters

Parameter
Description

txhex

Raw transaction data in hex.

Get a Transaction as Binary

This endpoint returns the transaction as a binary file for a given txid.

Example Request

URL Parameters

Parameter
Description

chain

Desired blockchain: bsv or btc.

network

Selected network: main or test.

txid

Transaction ID.

Get Raw Transaction Data

This endpoint returns the raw hex of a transaction for a given txid.

Example Request

Example Response

URL Parameters

Parameter
Description

chain

Desired blockchain: bsv or btc.

network

Selected network: main or test.

txid

Transaction ID.

Bulk Raw Transaction Data

You can get the raw data of multiple transactions in hex in a single request.

circle-info

Max 20 transactions per request.

Example Request

Example Response

URL Parameters

Parameter
Description

chain

Desired blockchain: bsv or btc.

network

Selected network: main or test.

Get Raw Transaction Output Data

This endpoint returns raw hex of the transaction output for a given transaction ID and output index.

Example Request

Example Response

URL Parameters

Parameter
Description

chain

Desired blockchain: bsv or btc.

network

Selected network: main or test.

txid

Transaction ID.

index

Output / Vout index.

Bulk Raw Transaction Output Data

This endpoint returns raw hex of the transaction output for a list of up to 40 transaction IDs and up to 40 output indexes per transaction.

Example Request

Example Response

URL Parameters

Parameter
Description

chain

Desired blockchain: bsv or btc.

network

Selected network: main or test.

Errors

Error
Description

unknown for that txId

If a given txId is unknown.

(Ignored)

If a given output is unknown.

Get Merkle Proof in TSC (BSV-only)

This endpoint returns the Merkle root of the branch for a confirmed transaction, in the TSCarrow-up-right format.

circle-info
  • Returns null for unconfirmed transactions.

  • The old, non-TSC-format endpoint is no longer supported.

URL Parameters

Parameter
Description

network

Selected network: main or test.

txid

Transaction ID.

Last updated

Was this helpful?