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.
I tried
decoderawtransaction 02000000000101fca5041df91d39bca183f0d477e44fef535f60fd8ba6b829aee8781407abda0800000000171600140976d58d4db681de489b95b549bcfa1333190ee9feffffff02661c43000000000017a9149a3aa2465229a8a9fc1614f8c83eb7107c94fa4887d8940300000000001976a9142745fd0fcf649cf333009589020bc2b40de12b3c88ac024730440220180d48c51fc0ad33d77a078d2bf3ee829bdf52e483ecac56c4c59e983cf30c8e02206f5712841bd6a97cce238b736aabee60c3f5b9365c2c38c11a0604e3c2c7de2201210366a92cde1eed31af6348ff72d6dab13b82ffec92fc7d8546c05530175e616c495e261700but I can't seeconfirmationsin there – bbnn – 2019-05-19T07:36:33.393@bbnn that is because
decoderawtransactiondoesn't give you the number of confirmations, hence why I suggested the use ofgetrawtransaction, which does. – chytrik – 2019-05-19T07:41:29.917the example that you gave produced error:
parameter 1 must be of length 64 (not 4, for 'txID')– bbnn – 2019-05-19T08:11:57.237oh I think I got it now I should replace the txID with the txID.. sorry – bbnn – 2019-05-19T08:12:57.383
@bbnn no problem, happy to help – chytrik – 2019-05-20T02:50:44.617