getrawtransaction
POST
Returns the raw transaction data for the given transaction id.The response format depends on the
verbosity value.📘 On a node without the -txindex option enabled, only transactions that still have an unspent output in the UTXO set can be queried.
Pass blockhash as well when querying a confirmed transaction.
param[0]
txidstringrequired
The transaction id to look up.param[1]
verbosityintegerrequired
The level of detail in the response. 0 returns a hex-encoded string, 1 the decoded transaction object, and 2 the transaction object including the fee and prevout data.param[2]
blockHashstringrequired
The hash of the block to look for the transaction in.Responses
in_active_chainboolean
Whether the specified block is in the active chain. Returned only when blockhash is provided.hexstring
The serialized transaction, hex-encoded.txidstring
The transaction id.hashstring
The transaction hash. It differs from txid for witness transactions.sizeinteger
The serialized transaction size, in bytes.vsizeinteger
The virtual transaction size as defined in BIP 141. It differs from size for witness transactions.weightinteger
The transaction weight as defined in BIP 141. The value is between vsize * 4 - 3 and vsize * 4.versioninteger
The transaction version.locktimeinteger
The lock time that determines when the transaction becomes valid.The list of transaction inputs.
coinbasestring
The coinbase value of the input. Returned only for coinbase inputs.txidstring
The id of the previous transaction referenced by this input. Returned only for non-coinbase inputs.voutinteger
The output index of the previous transaction referenced by this input. Returned only for non-coinbase inputs.The signature script (scriptSig) that unlocks the output referenced by the input.
asmstring
Disassembly of the script.hexstring
The script, hex-encoded.txinwitnessarray
The hex-encoded witness data. Returned only for SegWit inputs.The previous output spent by this input.It is returned when
verbosity is 2 for getrawtransaction or 3 for getblock,and omitted if the block undo data is not available.generatedboolean
Whether the output was generated by a coinbase transaction.heightinteger
The height of the block containing the previous output.valuenumber
The value of the previous output, denominated in BTC.The output script (scriptPubKey) that defines the conditions for spending the output.
asmstring
Disassembly of the script.descstring
Inferred descriptor for the script.hexstring
The raw script bytes, hex-encoded.addressstring
The Bitcoin address for the script. Returned only when a well-defined address exists.typestring
The output type.nonstandard: A script that does not match any standard type.anchor: A Pay-to-Anchor (P2A) output.pubkey: An output locked directly by a public key (P2PK).pubkeyhash: An output locked by a public key hash (P2PKH).scripthash: An output locked by a script hash (P2SH).multisig: An output that requires multiple signatures.nulldata: An output that only records data via OP_RETURN.witness_v0_keyhash: A SegWit v0 public key hash output (P2WPKH).witness_v0_scripthash: A SegWit v0 script hash output (P2WSH).witness_v1_taproot: A Taproot output (P2TR).witness_unknown: An output with an unknown witness version.
sequenceinteger
The script sequence number of the input.The list of transaction outputs.
valuenumber
The value of the output, denominated in BTC.ninteger
The index of the output within the transaction.The output script (scriptPubKey) that defines the conditions for spending the output.
asmstring
Disassembly of the script.descstring
Inferred descriptor for the script.hexstring
The raw script bytes, hex-encoded.addressstring
The Bitcoin address for the script. Returned only when a well-defined address exists.typestring
The output type.nonstandard: A script that does not match any standard type.anchor: A Pay-to-Anchor (P2A) output.pubkey: An output locked directly by a public key (P2PK).pubkeyhash: An output locked by a public key hash (P2PKH).scripthash: An output locked by a script hash (P2SH).multisig: An output that requires multiple signatures.nulldata: An output that only records data via OP_RETURN.witness_v0_keyhash: A SegWit v0 public key hash output (P2WPKH).witness_v0_scripthash: A SegWit v0 script hash output (P2WSH).witness_v1_taproot: A Taproot output (P2TR).witness_unknown: An output with an unknown witness version.
feenumber
The transaction fee, denominated in BTC.Returned when verbosity is 2, and omitted if the block undo data is not available.blockhashstring
The hash of the block containing the transaction.confirmationsinteger
The number of confirmations of the transaction.blocktimeinteger
The time of the block containing the transaction, expressed in UNIX epoch time.timeinteger
Same as blocktime.codestringrequired
Code identifying the cause of the failed request.messagestringrequired
Detailed message including the name and value of the invalid parameter.{"code": "ERROR_CODE","message": "Unauthorized"}
cURL
curl -X POST 'https://bitcoin-mainnet.nodit.io' \-H 'Content-Type: application/json' \-H 'X-API-KEY: nodit-demo' \-d '{"jsonrpc": "2.0","id": 1,"method": "getrawtransaction","params": ["4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b",2,"000000000000000000024bead8df69990852c202db0e0097c1a12ea637d7e96d"]}'