getrawtransaction - Bitcoin

getrawtransaction. Retrieves the raw, hexadecimal-encoded data of a specific Bitcoin transaction using its transaction ID.

getrawtransaction - bitcoin [Value: 30CU]
Retrieves the raw, hexadecimal-encoded data of a specific Bitcoin transaction using its transaction ID.
Use cases

Use cases

  • Retrieve raw data of a Bitcoin transaction
  • Analyze transaction details and inputs/outputs
  • Audit specific Bitcoin transactions
Constraints

Constraints

  • Requires a valid transaction ID
  • Only retrieves data for existing transactions
  • Depends on node sync
Get started
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
curl  https://bitcoin.drpc.org \
    -X POST \
    -H "Content-Type: application/json" \
    --data '{"method": "getrawtransaction", "params": ["10b54fd708ab2e5703979b4ba27ca0339882abc2062e77fbe51e625203a49642", 0]}'
Copy
Response
200
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "in_active_chain": true,
        "hex": "020000000001012c...<remaining raw transaction data>...",
        "txid": "10b54fd708ab2e5703979b4ba27ca0339882abc2062e77fbe51e625203a49642",
        "hash": "10b54fd708ab2e5703979b4ba27ca0339882abc2062e77fbe51e625203a49642",
        "size": 224,
        "vsize": 224,
        "weight": 896,
        "version": 2,
        "locktime": 0,
        "vin": [
            {
                "txid": "abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef",
                "vout": 1,
                "scriptSig": {
                    "asm": "3045022100abcdef...<signature>...02200abcdef...<public key>...",
                    "hex": "483045022100abcdef...<signature>...02200abcdef...<public key>...",
                },
                "sequence": 4294967295,
                "txinwitness": [
                    "abcdefabcdef...<witness data>..."
                ]
            }
        ],
        "vout": [
            {
                "value": 0.015,
                "n": 0,
                "scriptPubKey": {
                    "asm": "OP_DUP OP_HASH160 abcdefabcdefabcdefabcdefabcdefabcdef OP_EQUALVERIFY OP_CHECKSIG",
                    "hex": "76a914abcdefabcdefabcdefabcdefabcdef88ac",
                    "desc": "address",
                    "type": "pubkeyhash",
                    "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa"
                }
            },
            {
                "value": 0.005,
                "n": 1,
                "scriptPubKey": {
                    "asm": "OP_HASH160 abcdefabcdefabcdefabcdefabcdefabcdef OP_EQUAL",
                    "hex": "a914abcdefabcdefabcdefabcdefabcdef87",
                    "desc": "address",
                    "type": "pubkeyhash",
                    "address": "1dice8EMZmqKvrGE4Qc9sPzT2vG4nJ2A7"
                }
            }
        ],
        "blockhash": "0000000000000000000abcdefabcdefabcdefabcdefabcdefabcdefabcdef",
        "confirmations": 3,
        "blocktime": 1693527600,
        "time": 1693527600
    }
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersobject
object
txidstring
Required. The transaction ID.
verbosenumeric
Optional. A numeric parameter that can take one of the following values: '0' for hex-encoded data, '1' for JSON object, and '2' for JSON object with fee and prevout. Default is 0.
blockhashstring
Optional. The block in which to look for the transaction.

Response

200

Response params

object
idinteger
jsonrpcstring
strstring
The serialized, hex-encoded data for 'txid'.
resultobject
If verbose is set to true
object
in_active_chainboolean
Whether the specified block is in the active chain (only present with explicit 'blockhash' argument).
hexstring
The serialized, hex-encoded data for 'txid'.
txidstring
The transaction ID.
hashstring
The transaction hash (differs from txid for witness transactions).
sizenumeric
The transaction size.
vsizenumeric
The virtual transaction size (differs from the size for witness transactions).
weightnumeric
The transaction's weight (between vsize*4 - 3 and vsize*4).
versionnumeric
The block version.
locktimenumeric
The transaction locktime.
vinarray
A JSON array. Each element serves as a transaction's input vector (vin).
object
txidstring
The transaction ID.
voutnumeric
The output number.
scriptSigobject
The script's signature.
object
asmstring
The script's public key in the form of a string.
hexstring
The hex-encoded witness data.
sequencenumeric
The sequence number of the script.
txinwitnessarray
An array of JSON objects.
object
hexstring
The hex-encoded witness data.
voutarray
A JSON array containing transaction output information.
object
valuestring
The value in BTC.
nnumeric
The output index.
scriptPubKeyobject
A JSON object containing information about the PubKey script.
object
asmstring
The script public key in the form of a string.
hexstring
The hex of the script's public key in string format.
descstring
The inferred descriptor for the output.
typestring
The type of script, e.g., pubkeyhash, multisig.
addressstring
The Bitcoin address.
blockhashstring
The block hash.
confirmationsinteger
The number of confirmed transactions in the block.
blocktimeinteger
The block time expressed in UNIX epoch time.
timeinteger
Same as 'blocktime'.