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

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

CC BY-SA 3.0
2017-09-13T16:25:29.657Z
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
CC BY-SA 3.0
2017-09-13T16:29:24.380Z
Bitcoin Core will return transaction information for transactions you sent (and maybe received, not sure about this one).
alcio
CC BY-SA 3.0
2017-09-15T20:18:31.957Z
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
CC BY-SA 3.0
2017-09-15T20:24:09.653Z
`getrawtransaction` seems to work with all transactions I checked, but `gettransaction` still fails.
Jack O'Neill
CC BY-SA 4.0
2023-08-28T17:09:58.440Z
You must run Bitcoin Core with `-reindex` option and wait till whole reindex. `gettransaction` works only for wallet txes, `getrawtransaction` works for all txes.
pbies
CC BY-SA 3.0
2017-09-13T15:27:38.110Z
2017-09-13T15:27:38.110Z
alcio
<p>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</p>

<blockquote>
  <p>gettransaction 8c0430d0139603db9983daf539604c612b3f7e8d5244aefc3cd3181ece08dd1f</p>
</blockquote>

<p>Instead of a json-output with the decoded transaction I get </p>

<blockquote>
  <p>Invalid or non-wallet transaction id (code -5)</p>
</blockquote>

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

<p>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?</p>

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

<p>I run a bitcoin core 0.14.2 and my blockchain is up-to-date.</p>

<transactions><bitcoin-core>
unable to get transactions in wallet console
Jack O'Neill
# unable to get transactions in wallet console

(Asked by: username_0 on 2017-09-13)

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.

**Tags:** transactions, bitcoin-core


---

## 1 answers

### Answer by username_1 on 2017-09-13. Score: 1 | Accepted answer

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.

> **Comments:**
> **username_0**: 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?  
> **username_1**: Bitcoin Core will return transaction information for transactions you sent (and maybe received, not sure about this one).  
> **username_0**: 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.  
> **username_0**: `getrawtransaction` seems to work with all transactions I checked, but `gettransaction` still fails.  
> **username_2**: You must run Bitcoin Core with `-reindex` option and wait till whole reindex. `gettransaction` works only for wallet txes, `getrawtransaction` works for all txes.  

---

