Skip to main content

getrawtransaction


description: Give back the unprocessed transaction data.​

getrawtransaction

This function only functions with mempool transactions by default. If the provided block is available and the transaction is located in that block, getrawtransactionβ€”when called with a blockhash argumentβ€”will return the transaction. Getrawtransaction will return the transaction if it is in the mempool or, if -txindex is enabled and the transaction is in a block on the blockchain, if it is called without a blockhash argument.

info

Advice: For wallet transactions, use gettransaction.

Returns an Object containing information about "txid" if verbose is "true."

Provides a string containing serialized, hex-encoded data for 'txid' if verbose is either 'false' or left off.

Example Request and Result for getrawtransaction method​

In this section, we provide an illustrative example of a request made to retrieve details contents using the getrawtransaction method. Additionally, we present the resulting response containing information about the unprocessed transaction data.

Parameters​

FieldTypeDescription

txid*

stringThe transaction id
verbosebooleanIf false, return a string, otherwise return a json object
blockhashstringThe block in which to look for the transaction
info

The example in this section uses a non-existing project id.

Make sure you replace it with your Bitcoin mainnet or Bitcoin Testnet endpoint when issuing the API calls.

Don't have a project id? Here's a straightforward guide on how to obtain one!

Provides the number of blocks for which the estimate is valid ​

POST https://bitcoin-mainnet.blastapi.io/<project-id>

Request Body​

NameTypeDescription
jsonrpc*string1.0
id*stringbwarelabs
method*stringgetrawtransaction
params*string["a071d2a7abb989bd47d186b6b4bfe74b9673d5529dbfcf8f76229720f6b867c4", true]
{
"result": {
"txid": "a071d2a7abb989bd47d186b6b4bfe74b9673d5529dbfcf8f76229720f6b867c4",
"hash": "11d2853df80f28604c305c0fdc0d7bd5b452f09c229846290b12e5a86627a3dc",
"version": 1,
"size": 102076,
"vsize": 54421,
"weight": 217681,
"locktime": 0,
"vin": [
{
"txid": "79518f632b5f7c974a1603d41d17b62540e6a04f9e98270c62499cd0d525d121",
"vout": 25,
"scriptSig": {
"asm": "001429014df2a89e66226d3267bba99ab071b28197b9",
"hex": "16001429014df2a89e66226d3267bba99ab071b28197b9"
},
"txinwitness": [
"304402203f251bdab7a81d3b5763fd12833977ce1a51df93d4a80df0661abe0f8715ccc702203447b4d871d980e150e9a4c73950ef7ba7dda0943ff6741494d60c71e34d6d7d01",
"029eea9a858fec8537242c53eb328a672fd5f4c8ce1bab6dc603952a3355f22f41"
],
"sequence": 4294967295
},
...
"vout": [
{
"value": 8.29761253,
"n": 0,
"scriptPubKey": {
"asm": "0 ad0bb347149ac1889c8b92140daa7ad06a14a3b2",
"desc": "addr(bc1q459mx3c5ntqc38ytjg2qm2n66p4pfgajlpzvwu)#w4ky3fht",
"hex": "0014ad0bb347149ac1889c8b92140daa7ad06a14a3b2",
"address": "bc1q459mx3c5ntqc38ytjg2qm2n66p4pfgajlpzvwu",
"type": "witness_v0_keyhash"
}
}
],
"hex": "010000000001fd580221d125d5d09c49620c27989e4fa0e64025b6171dd403164a977c5f2b638f5179190000001716001429014df2a89e662
...
"blockhash": "00000000000000000002fd6ee2ed7448d10cc29400fb102f16f3c9f8e0159b14",
"confirmations": 45489,
"time": 1681218131,
"blocktime": 1681218131
},
"error": null,
"id": "bwarelabs"
}

Curl Request example​

curl --location 'https://bitcoin-mainnet.blastapi.io/<project-id>' \
--header 'content-type: application/json;' \
--data '{
"jsonrpc": "1.0",
"id": "bwarelabs",
"method": "getrawtransaction",
"params": [
"a071d2a7abb989bd47d186b6b4bfe74b9673d5529dbfcf8f76229720f6b867c4",
true
]
}'