<p>Use <code>bitcoin-cli getrawtransaction "txID" 1</code></p>

<p>The output will include a <code>"confirmations"</code> field, telling you how many confirmations the transaction currently has. </p>

<p>Note that to get this information for transactions not related to your wallet, you will need to set <code>txindex=1</code> when syncing your your node, or provide <code>bitcoin-cli</code> with the blockhash of the block the transaction was included in. Here is some more info about this, copied from the output of <code>bitcoin-cli help getrawtransaction</code>, running v0.17.0.1:</p>

<pre><code>NOTE: By default this function only works for mempool transactions. If the -txindex option is
enabled, it also works for blockchain transactions. If the block which contains the transaction
is known, its hash can be provided even for nodes without -txindex. Note that if a blockhash is
provided, only that block will be searched and if the transaction is in the mempool or other
blocks, or if this node does not have the given block available, the transaction will not be found. 
</code></pre>

CC BY-SA 4.0
2019-05-19T07:36:33.393Z
I tried `decoderawtransaction 02000000000101fca5041df91d39bca183f0d477e44fef535f60fd8ba6b829aee8781407abda0800000000171600140976d58d4db681de489b95b549bcfa1333190ee9feffffff02661c43000000000017a9149a3aa2465229a8a9fc1614f8c83eb7107c94fa4887d8940300000000001976a9142745fd0fcf649cf333009589020bc2b40de12b3c88ac024730440220180d48c51fc0ad33d77a078d2bf3ee829bdf52e483ecac56c4c59e983cf30c8e02206f5712841bd6a97cce238b736aabee60c3f5b9365c2c38c11a0604e3c2c7de2201210366a92cde1eed31af6348ff72d6dab13b82ffec92fc7d8546c05530175e616c495e261700`
but I can't see `confirmations` in there
bbnn
CC BY-SA 4.0
2019-05-19T07:41:29.917Z
@bbnn that is because `decoderawtransaction` doesn't give you the number of confirmations, hence why I suggested the use of `getrawtransaction`, which does.
chytrik
CC BY-SA 4.0
2019-05-19T08:11:57.237Z
the example that you gave produced error: ```parameter 1 must be of length 64 (not 4, for 'txID')```
bbnn
CC BY-SA 4.0
2019-05-19T08:12:57.383Z
oh I think I got it now I should replace the txID with the txID.. sorry
bbnn
CC BY-SA 4.0
2019-05-20T02:50:44.617Z
@bbnn no problem, happy to help
chytrik
CC BY-SA 4.0
2019-05-19T07:29:06.210Z
2019-05-19T07:48:11.117Z
2019-05-19T07:48:11.117Z
chytrik
<p>I have a question,
How can I get the number of transaction confirmation by using bitcoind?</p>

<p>for example:
<a href="https://live.blockcypher.com/btc-testnet/tx/9fd745521000d1aadb1f4857e44817c3342d02585af93c83d19dc3f3f4425594/" rel="nofollow noreferrer">https://live.blockcypher.com/btc-testnet/tx/9fd745521000d1aadb1f4857e44817c3342d02585af93c83d19dc3f3f4425594/</a></p>

<p>you can see the number of CONFIRMATIONS on that page</p>

<p>thank you in advance!</p>

<transactions><blockchain><bitcoind>
How to get number of transaction confirmation from bitcoind?
bbnn
# How to get number of transaction confirmation from bitcoind?

(Asked by: username_0 on 2019-05-19)

I have a question,
How can I get the number of transaction confirmation by using bitcoind?

for example:
<https://live.blockcypher.com/btc-testnet/tx/9fd745521000d1aadb1f4857e44817c3342d02585af93c83d19dc3f3f4425594/>

you can see the number of CONFIRMATIONS on that page

thank you in advance!

**Tags:** transactions, blockchain, bitcoind


---

## 1 answers

### Answer by username_1 on 2019-05-19. Score: 1 | Accepted answer

Use bitcoin-cli getrawtransaction "txID" 1
The output will include a "confirmations" field, telling you how many confirmations the transaction currently has. 
Note that to get this information for transactions not related to your wallet, you will need to set txindex=1 when syncing your your node, or provide bitcoin-cli with the blockhash of the block the transaction was included in. Here is some more info about this, copied from the output of bitcoin-cli help getrawtransaction, running v0.17.0.1:
NOTE: By default this function only works for mempool transactions. If the -txindex option is
enabled, it also works for blockchain transactions. If the block which contains the transaction
is known, its hash can be provided even for nodes without -txindex. Note that if a blockhash is
provided, only that block will be searched and if the transaction is in the mempool or other
blocks, or if this node does not have the given block available, the transaction will not be found.

> **Comments:**
> **username_0**: I tried `decoderawtransaction 02000000000101fca5041df91d39bca183f0d477e44fef535f60fd8ba6b829aee8781407abda0800000000171600140976d58d4db681de489b95b549bcfa1333190ee9feffffff02661c43000000000017a9149a3aa2465229a8a9fc1614f8c83eb7107c94fa4887d8940300000000001976a9142745fd0fcf649cf333009589020bc2b40de12b3c88ac024730440220180d48c51fc0ad33d77a078d2bf3ee829bdf52e483ecac56c4c59e983cf30c8e02206f5712841bd6a97cce238b736aabee60c3f5b9365c2c38c11a0604e3c2c7de2201210366a92cde1eed31af6348ff72d6dab13b82ffec92fc7d8546c05530175e616c495e261700` but I can't see `confirmations` in there  
> **username_1**: @username_0 that is because `decoderawtransaction` doesn't give you the number of confirmations, hence why I suggested the use of `getrawtransaction`, which does.  
> **username_0**: the example that you gave produced error: ```parameter 1 must be of length 64 (not 4, for 'txID')```  
> **username_0**: oh I think I got it now I should replace the txID with the txID.. sorry  
> **username_1**: @username_0 no problem, happy to help  

---

