1

I'm trying to get transactions infos out of the bitcoin core wallet with the console. For that I picked a random transaction of a block from today and tried to access it with

gettransaction 8c0430d0139603db9983daf539604c612b3f7e8d5244aefc3cd3181ece08dd1f

Instead of a json-output with the decoded transaction I get

Invalid or non-wallet transaction id (code -5)

Shouldn't I be able to retrieve every transaction in the blockchain with this command?

How can I read/access the transactions included in mined blocks? I already did this on some altcoins with PoS and there is was possible for every transaction. Now with bitcoin it seems that only wallet transactions are available? Why is that and can I get around that to access / read the transactions on my own?

The same problem appears to be with the getrawtransaction command, so I can even decode a transaction on my own.

I run a bitcoin core 0.14.2 and my blockchain is up-to-date.

1

To retrieve arbitrary transactions in the Bitcoin Core console, you need to use the txindex=1 option in your configuration file.

Note that setting that option will trigger a full rescan of the blockchain that might (depending on your setup) take several hours to complete.

  • thanks. I'm rescanning now and try again after that. I also observed, that some transactions did return tx-data anyway without txindex set to 1. Can you explain how that could be possible? – Jack O'neill Sep 13 '17 at 16:25
  • Bitcoin Core will return transaction information for transactions you sent (and maybe received, not sure about this one). – alcio Sep 13 '17 at 16:29
  • I set txindex=1 and did a full rescan (took long time). after that I restartet my client and tried again. Still not able to access transactions. Same error again. – Jack O'neill Sep 15 '17 at 20:18
  • getrawtransaction seems to work with all transactions I checked, but gettransaction still fails. – Jack O'neill Sep 15 '17 at 20:24

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.