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.
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.
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.