I installed bitcoind on my linux server. So far, it has downloaded blocks 0-386561 according to bitcoin-cli getinfo.

I went to a random block within that range, and picked up this transaction:

TXID: a3d7b336b5e1024de75c21612bc8af7f4b30e05ccb863a438463fda4034d34db

I want to check how many confirmations this transaction has using my bitcoind through a CLI command.

So I typed bitcoin-cli gettransaction a3d7b336b5e1024de75c21612bc8af7f4b30e05ccb863a438463fda4034d34db.

It gave me this: enter image description here

Can someone please explain what is wrong??


Like it says, gettransaction can only return info on transactions which are part of your wallet, i.e. those which send coins to or from one of your own addresses.

Normally Bitcoin Core doesn't keep track of any data on non-wallet transactions, but this can be turned on with the -txindex option. (Building the transaction index for the first time will also require you to reindex the entire blockchain with -reindex, which will take several hours to days and a fair amount of extra disk space.) With this turned on, you can use getrawtransaction with any past transaction, wallet or not; if you want human-readable output, including number of confirmations, add true after the txid.

| improve this answer | |
  • A node can be pruned (example prune=550) and have -txindex on, right? – 2523454 Feb 5 '18 at 2:55
  • I can't think of any reason why not, but I haven't tested. – Nate Eldredge Feb 5 '18 at 2:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.