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

CC BY-SA 3.0
2014-10-09T08:42:00.213Z
"txindex=1" flag set to keep a full transaction index.>>>> does this give us the confirmation count ?
Rıfat Erdem Sahin
CC BY-SA 3.0
2014-10-09T15:27:29.370Z
Setting "txindex" to 1 tells the bitcoin node to keep track of all transactions, not just the ones relevant to your wallet. This way you can use "getrawtransaction" on any txid (Barring the genesis block coinbase transaction, as that is not technically a valid tx). You will also need to run with "reindex=1" if you already have the blockchain downloaded and need to refresh it to use this new indexing system. (All of these settings can also be set in your "Bitcoin.conf" configuration file as opposed to command line flags https://en.bitcoin.it/wiki/Running_Bitcoin#Bitcoin.conf_Configuration_File)
CJ-Coinsetter
CC BY-SA 3.0
2014-10-08T16:03:50.253Z
2014-10-08T16:03:50.253Z
CJ-Coinsetter
<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>

CC BY-SA 3.0
2016-01-12T00:23:35.410Z
2016-01-12T14:55:00.137Z
2016-01-12T14:55:00.137Z
Muneeb Ali
<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>

CC BY-SA 3.0
2014-10-08T13:58:27.733Z
Can you clarify the question? Do you want to know confirmation count for addresses which you own the private key for or is that what you mean by "empty wallet"? Also, clarify scale of project (ie estimated number of addresses you're checking and how ften). More dtails the better!
Wizard Of Ozzie
<bitcoind><bitcoin-core><json-rpc>
How to get the number of the confirmed transactions from Bitcoin QT Rpc
Rıfat Erdem Sahin
# How to get the number of the confirmed transactions from Bitcoin QT Rpc

(Asked by: username_0 on 2014-10-08)

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.

**Tags:** bitcoind, bitcoin-core, json-rpc

> **Comments:**
> **username_1**: Can you clarify the question? Do you want to know confirmation count for addresses which you own the private key for or is that what you mean by "empty wallet"? Also, clarify scale of project (ie estimated number of addresses you're checking and how ften). More dtails the better!  

---

## 2 answers

### Answer by username_2 on 2014-10-08. Score: 5

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.

> **Comments:**
> **username_0**: "txindex=1" flag set to keep a full transaction index.>>>> does this give us the confirmation count ?  
> **username_2**: Setting "txindex" to 1 tells the bitcoin node to keep track of all transactions, not just the ones relevant to your wallet. This way you can use "getrawtransaction" on any txid (Barring the genesis block coinbase transaction, as that is not technically a valid tx). You will also need to run with "reindex=1" if you already have the blockchain downloaded and need to refresh it to use this new indexing system. (All of these settings can also be set in your "Bitcoin.conf" configuration file as opposed to command line flags https://en.bitcoin.it/wiki/Running_Bitcoin#Bitcoin.conf_Configuration_File)  

---

### Answer by username_3 on 2016-01-12. Score: 1

You will need to:

1. Set txindex=1 in ~/.bitcoin/bitcoin.conf
2. 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.


---

