getrawtransaction
Summary
By default, this call only returns a transaction if it is in the mempool. If -txindex is enabled
Description
By default, this call only returns a transaction if it is in the mempool. If -txindex is enabled and no blockhash argument is passed, it will return the transaction if it is in the mempool or any block. If a blockhash argument is passed, it will return the transaction if the specified block is available and the transaction is in that block.
Hint: Use gettransaction for wallet transactions.
If verbosity is 0 or omitted, returns the serialized transaction as a hex-encoded string. If verbosity is 1, returns a JSON Object with information about the transaction. If verbosity is 2, returns a JSON Object with information about the transaction, including fee and prevout information.
Arguments
txid(STR_HEX, required): The transaction idverbosity(NUM): 0 for hex-encoded data, 1 for a JSON object, and 2 for JSON object with fee and prevoutblockhash(STR_HEX): The block in which to look for the transaction
Results
data(STR): The serialized transaction as a hex-encoded string for 'txid'value(OBJ): No description.in_active_chain(BOOL, optional): Whether specified block is in the active chain or not (only present with explicit "blockhash" argument)blockhash(STR_HEX, optional): the block hashconfirmations(NUM, optional): The confirmationsblocktime(NUM_TIME, optional): The block time expressed in UNIX epoch timetime(NUM, optional): Same as "blocktime"hex(STR_HEX): The serialized, hex-encoded data for 'txid'txid(STR_HEX): The transaction id (same as provided)hash(STR_HEX): The transaction hash (differs from txid for witness transactions)size(NUM): The serialized transaction sizevsize(NUM): The virtual transaction sizeweight(NUM): The transaction's weight; qbit fully counts witness dataversion(NUM): The versionlocktime(NUM_TIME): The lock timevin(ARR): No description.value(OBJ): No description.coinbase(STR_HEX, optional): The coinbase value (only if coinbase transaction)txid(STR_HEX, optional): The transaction id (if not coinbase transaction)vout(NUM, optional): The output number (if not coinbase transaction)scriptSig(OBJ, optional): The script (if not coinbase transaction)asm(STR): Disassembly of the signature scripthex(STR_HEX): The raw signature script bytes, hex-encoded
txinwitness(ARR, optional): No description.hex(STR_HEX): hex-encoded witness data (if any)
sequence(NUM): The script sequence number
vout(ARR): No description.value(OBJ): No description.value(STR_AMOUNT): The value in QBTn(NUM): indexscriptPubKey(OBJ): No description.asm(STR): Disassembly of the output scriptdesc(STR): Inferred descriptor for the outputhex(STR_HEX): The raw output script bytes, hex-encodedaddress(STR, optional): The qbit address (only if a well-defined address exists)type(STR): The type (one of: nonstandard, anchor, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_scripthash, witness_v0_keyhash, witness_v1_taproot, witness_v2_p2mr, witness_unknown)
value(OBJ): No description.value(ELISION): Same output as verbosity = 1fee(NUM, optional): transaction fee in QBT, omitted if block undo data is not availablevin(ARR): No description.value(OBJ): utxo being spentvalue(ELISION): Same output as verbosity = 1prevout(OBJ, optional): The previous output, omitted if block undo data is not availablegenerated(BOOL): Coinbase or notheight(NUM): The height of the prevoutvalue(STR_AMOUNT): The value in QBTscriptPubKey(OBJ): No description.asm(STR): Disassembly of the output scriptdesc(STR): Inferred descriptor for the outputhex(STR_HEX): The raw output script bytes, hex-encodedaddress(STR, optional): The qbit address (only if a well-defined address exists)type(STR): The type (one of: nonstandard, anchor, pubkey, pubkeyhash, scripthash, multisig, nulldata, witness_v0_scripthash, witness_v0_keyhash, witness_v1_taproot, witness_v2_p2mr, witness_unknown)
Examples
qbit-cli getrawtransaction "mytxid"
qbit-cli getrawtransaction "mytxid" 1
curl --user myusername --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "getrawtransaction", "params": ["mytxid", 1]}' -H 'content-type: application/json' http://127.0.0.1:8352/
qbit-cli getrawtransaction "mytxid" 0 "myblockhash"
qbit-cli getrawtransaction "mytxid" 1 "myblockhash"
qbit-cli getrawtransaction "mytxid" 2 "myblockhash"