Transaction

Get by Tx Hash

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

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, block 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/<hash>
cURL
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/tx/hash/c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96"
Response JSON structure
{
  "txid": "c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96",
  "hash": "c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96",
  "size": 113,
  "version": 1,
  "locktime": 0,
  "vin": [
    {
      "txid": "",
      "vout": 0,
      "scriptSig": {
        "asm": "... ",
        "hex": "..."
      },
      "sequence": 4294967295,
      "coinbase": "03d7c6082f7376706f6f6c2e636f6d2f3edff034600055b8467f0040"
    }
  ],
  "vout": [
    {
      "value": 12.5000042,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 492558fb8ca71a3591316d095afc0f20ef7d42f7 OP_EQUALVERIFY OP_CHECKSIG", // (max 100 KB)
        "hex": "76a914492558fb8ca71a3591316d095afc0f20ef7d42f788ac", // (max 100 KB)
        "reqSigs": 1,
        "type": 0,
        "addresses": ["17fm4xevwDh3XRHv9UoqYrVgPMbwcGHsUs"],
        "opReturn": null,
        "isTruncated": false
      }
    }
  ],
  "blockhash": "0000000000000000091216c46973d82db057a6f9911352892b7769ed517681c3",
  "confirmations": 2,
  "time": 1553501874,
  "blocktime": 1553501874

URL Parameters

ParameterDescription

network

The selected network: main, test, or stn.

hash

The hash/txId of the transaction to retrieve.

Get Transaction Propagation Status

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.

This is an expensive call, so it's recommended only for critical or high-value transactions that might require checking the network propagation status. It is rate-limited to 10 requests per 10 seconds.

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.

HTTP Request
GET https://api.whatsonchain.com/v1/bsv/<network>/tx/hash/<hash>/propagation
cURL
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/<network>/tx/hash/<hash>/propagation"
Response JSON structure
{
  "queried_peers": 16,
  "found_on_peers": 16
}

URL Parameters

ParameterDescription

network

The selected network: main or test.

hash

The hash/txId of the transaction.

Broadcast Transaction

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

Keep in mind that this endpoint is meant for small-scale usage. For commercial or enterprise usage, please take a look at ARC Endpoints (beta), which are built for those types of use cases.

HTTP Request
POST https://api.whatsonchain.com/v1/bsv/<network>/tx/raw
cURL
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/tx/raw" \
  --header "Content-Type: application/json" \
  --data "{\"txhex\": \"hex...\" }"
The JSON structure for the above post request:
{
  "txhex": "hex..."
}

URL Parameters

ParameterDescription

network

The selected network: main, test, or stn.

Request Body

ParameterDescription

txhex

The raw transaction data in hex.

Bulk Transaction Details

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

  • Max 20 transactions per request.

HTTP Request
POST https://api.whatsonchain.com/v1/bsv/<network>/txs
cURL
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/txs" \
  --header "Content-Type: application/json" \
  --data "{\"txids\" : [\"294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa\",\"91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258\" ] }"
The JSON structure for the above post request:
{
  "txids": [
    "294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa",
    "91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258"
  ]
}

URL Parameters

ParameterDescription

network

The selected network: main, test, or stn.

Bulk Transaction Status

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

  • Max 20 transactions per request.

HTTP Request
POST https://api.whatsonchain.com/v1/bsv/<network>/txs/status
cURL
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/txs/status" \
  --header "Content-Type: application/json" \
  --data "{\"txids\" : [\"294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa\",\"91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258\" ] }"
The JSON structure for the above post request:
{
  "txids": [
    "294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa",
    "91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258"
  ]
}
Response JSON structure
[
  {
    "txid": "294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa",
    "blockhash": "000000000000000004b5ce6670f2ff27354a1e87d0a01bf61f3307f4ccd358b5",
    "blockheight": 612251,
    "blocktime": 1575841517,
    "confirmations": 86479
  },
  {
    "txid": "91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258",
    "blockhash": "000000000000000002e8d4b4c0385abd195709c82f16d9917f081b70000e8804",
    "blockheight": 617279,
    "blocktime": 1578837295,
    "confirmations": 81451
  }
]

URL Parameters

ParameterDescription

network

The 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.

HTTP Request
POST https://api.whatsonchain.com/v1/bsv/<network>/tx/decode
cURL
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/tx/decode" \
  --header "Content-Type: application/json" \
  --data "{\"txhex\": \"hex...\" }"
Post request body JSON structure
{
  "txhex": "hex..."
}
Response JSON structure
{
  "txid": "c203094f5bacd5d5dcabb997adab1923b3ec9b91667ff230cac51504e34a382d",
  "hash": "c203094f5bacd5d5dcabb997adab1923b3ec9b91667ff230cac51504e34a382d",
  "version": 1,
  "size": 111,
  "locktime": 0,
  "vin": [
    {
      "coinbase": "03fc3b092f7376706f6f6c2e636f6d2f49a4a636f07dad7dc7c30100",
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 12.52346603,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_HASH160 1314c7eace4d4da3f65a1341197bb58038aa9dbc OP_EQUAL",
        "hex": "a9141314c7eace4d4da3f65a1341197bb58038aa9dbc87",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": ["33Ruf5AZhSPHSCGbYiuu3xG5V3HvoNFfby"]
      }
    }
  ],
  "hex": "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1c03fc3b092f7376706f6f6c2e636f6d2f49a4a636f07dad7dc7c30100ffffffff01eb4aa54a0000000017a9141314c7eace4d4da3f65a1341197bb58038aa9dbc8700000000"
}

URL Parameters

ParameterDescription

network

The selected network: main, test, or stn.

Request Body

ParameterDescription

txhex

The raw transaction data in hex.

Download Receipt

You can download the transaction receipt (in PDF).

HTTP Request
GET https://<network>.whatsonchain.com/receipt/<hash>
cURL
curl --location --request GET  "https://main.whatsonchain.com/receipt/4bdbdb7483c1c7ef48cda78ee4141af7cf15f94e10324e0bcac43c29394ea4a9"

URL Parameters

ParameterDescription

network

The selected network: main, test, or stn.

hash

The hash/txId of the transaction.

Get Raw Transaction Data

You can get the raw transaction data in hex.

This endpoint returns the raw hex for the transaction with given hash.

HTTP Request
GET https://api.whatsonchain.com/v1/bsv/<network>/tx/<hash>/hex
cURL
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/tx/c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96/hex"
Response with header content-type: text/plain:
01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1c03d7c6082f7376706f6f6c2e636f6d2f3edff034600055b8467f0040ffffffff01247e814a000000001976a914492558fb8ca71a3591316d095afc0f20ef7d42f788ac00000000

URL Parameters

ParameterDescription

network

The selected network: main or test.

hash

The hash/txId of the transaction.

Bulk Raw Transaction Data

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

  • Max 20 transactions per request.

HTTP Request
POST https://api.whatsonchain.com/v1/bsv/<network>/txs/hex
cURL
curl --location --request POST "https://api.whatsonchain.com/v1/bsv/main/txs/hex" \
  --header "Content-Type: application/json" \
  --data "{\"txids\" : [\"294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa\",\"91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258\" ] }"
The JSON structure for the above post request:
{
  "txids": [
    "294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa",
    "91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258"
  ]
}
Response JSON structure:
[
  {
    "txid": "294cd1ebd5689fdee03509f92c32184c0f52f037d4046af250229b97e0c8f1aa",
    "hex": "0100000001...00000000",
    "blockhash": "000000000000000004b5ce6670f2ff27354a1e87d0a01bf61f3307f4ccd358b5",
    "blockheight": 612251,
    "blocktime": 1575841517,
    "confirmations": 86479
  },
  {
    "txid": "91f68c2c598bc73812dd32d60ab67005eac498bef5f0c45b822b3c9468ba3258",
    "hex": "0100000001...00000000",
    "blockhash": "000000000000000002e8d4b4c0385abd195709c82f16d9917f081b70000e8804",
    "blockheight": 617279,
    "blocktime": 1578837295,
    "confirmations": 81451
  }
]

URL Parameters

ParameterDescription

network

The selected network: main or test.

Get Raw Transaction Output Data

You can get the raw transaction vout data in hex.

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

HTTP Request
GET https://api.whatsonchain.com/v1/bsv/<network>/tx/<hash>/out/<index>/hex
cURL
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/tx/c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96/out/0/hex"
Response with header content-type: text/plain:
76a914492558fb8ca71a3591316d095afc0f20ef7d42f788ac

URL Parameters

ParameterDescription

network

The selected network: main or test.

hash

The hash/txId of the transaction.

index

The Output/Vout index.

Get Merkle Proof

This endpoint returns the Merkle root of the branch for a confirmed transaction. Returns null for unconfirmed transactions.

HTTP Request
GET https://api.whatsonchain.com/v1/bsv/<network>/tx/<hash>/proof
cURL
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/tx/c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96/proof"
Response JSON structure
[
  {
    "blockHash": "0000000000000000091216c46973d82db057a6f9911352892b7769ed517681c3",
    "branches": [
      {
        "hash": "7e0ba1980522125f1f40d19a249ab3ae036001b991776813d25aebe08e8b8a50",
        "pos": "R"
      },
      {
        "hash": "1e3a5a8946e0caf07006f6c4f76773d7e474d4f240a276844f866bd09820adb3",
        "pos": "R"
      }
    ],
    "hash": "c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96",
    "merkleRoot": "95a920b1002bed05379a0d2650bb13eb216138f28ee80172f4cf21048528dc60"
  }
]

To get the response in the TSC format, add "/tsc" to the request at the end.

HTTP Request
GET https://api.whatsonchain.com/v1/bsv/<network>/tx/<hash>/proof/tsc
cURL
curl --location --request GET  "https://api.whatsonchain.com/v1/bsv/main/tx/c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96/proof/tsc"
Response JSON structure
[
    {
        "index": 0,
        "txOrId": "c1d32f28baa27a376ba977f6a8de6ce0a87041157cef0274b20bfda2b0d8df96",
        "target": "0000000000000000091216c46973d82db057a6f9911352892b7769ed517681c3",
        "nodes": [
            "7e0ba1980522125f1f40d19a249ab3ae036001b991776813d25aebe08e8b8a50",
            "1e3a5a8946e0caf07006f6c4f76773d7e474d4f240a276844f866bd09820adb3"
        ]
    }
]

URL Parameters

ParameterDescription

network

The selected network: main or test.

hash

The hash/txId of the transaction.

Last updated