user15501: We are building a generic wrapper around Bitcoin-Qt. I wonder if there is way to get the information about the confirmation count of a transaction from a Bitcoin-QT having an empty wallet using the RPC command.

user13713: You will need to:

Set txindex=1 in ~/.bitcoin/bitcoin.conf
Restart bitcoind with -reindex option i.e., 


bitcoind -reindex &


After this, use 'getrawtransaction' command and provide the additional argument '1' to get the response in JSON format, i.e.,

bitcoin-cli getrawtransaction your_tx_hash 1

Interestingly, first getting the raw transaction in hex (without the additional argument 1) and then using 'decoderawtransaction' does not give you the 'confirmations' field in the output.

user18254: You can use the RPC command "getrawtransaction" to receive a JSON response with information for that transaction including a "confirmations" field if that transaction has been included in a block (if there are 0 confirmations the confirmations field will not be there). You should note though that if you are looking for transactions that are not actually a part of your wallet (from or to an address you don't have the private keys for) bitcoin-qt by default won't keep track of these transactions and will have to be run with the "txindex=1" flag set to keep a full transaction index.

15501: <p>We are building a generic wrapper around Bitcoin-Qt. I wonder if there is way to get the information about the confirmation count of a transaction from a Bitcoin-QT having an empty wallet using the RPC command.</p>
 13713: <p>You will need to:</p>

<ol>
<li>Set txindex=1 in ~/.bitcoin/bitcoin.conf</li>
<li>Restart bitcoind with -reindex option i.e., 

<blockquote>
  <p>bitcoind -reindex &amp;</p>
</blockquote></li>
</ol>

<p>After this, use 'getrawtransaction' command and provide the additional argument '1' to get the response in JSON format, i.e.,</p>

<blockquote>
  <p>bitcoin-cli getrawtransaction your_tx_hash 1</p>
</blockquote>

<p>Interestingly, first getting the raw transaction in hex (without the additional argument 1) and then using 'decoderawtransaction' <strong>does not</strong> give you the 'confirmations' field in the output.</p>
 18254: <p>You can use the RPC command "getrawtransaction" to receive a JSON response with information for that transaction including a "confirmations" field if that transaction has been included in a block (if there are 0 confirmations the confirmations field will not be there). You should note though that if you are looking for transactions that are not actually a part of your wallet (from or to an address you don't have the private keys for) bitcoin-qt by default won't keep track of these transactions and will have to be run with the "txindex=1" flag set to keep a full transaction index.</p>
