getrawtransaction

Back to rawtransactions

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 id
  • verbosity (NUM): 0 for hex-encoded data, 1 for a JSON object, and 2 for JSON object with fee and prevout
  • blockhash (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 hash
  • confirmations (NUM, optional): The confirmations
  • blocktime (NUM_TIME, optional): The block time expressed in UNIX epoch time
  • time (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 size
  • vsize (NUM): The virtual transaction size
  • weight (NUM): The transaction's weight; qbit fully counts witness data
  • version (NUM): The version
  • locktime (NUM_TIME): The lock time
  • vin (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 script
      • hex (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 QBT
    • n (NUM): index
    • scriptPubKey (OBJ): No description.
      • asm (STR): Disassembly of the output script
      • desc (STR): Inferred descriptor for the output
      • hex (STR_HEX): The raw output script bytes, hex-encoded
      • address (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 = 1
  • fee (NUM, optional): transaction fee in QBT, omitted if block undo data is not available
  • vin (ARR): No description.
    • value (OBJ): utxo being spent
    • value (ELISION): Same output as verbosity = 1
    • prevout (OBJ, optional): The previous output, omitted if block undo data is not available
      • generated (BOOL): Coinbase or not
      • height (NUM): The height of the prevout
      • value (STR_AMOUNT): The value in QBT
      • scriptPubKey (OBJ): No description.
      • asm (STR): Disassembly of the output script
      • desc (STR): Inferred descriptor for the output
      • hex (STR_HEX): The raw output script bytes, hex-encoded
      • address (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"