<p>You need the transaction index enabled of you want to use <code>getrawtransaction</code> on arbitrary transactions. By default, only transactions that have unspent outputs are available.</p>

<p>Run bitcoind with <code>-txindex</code> or put <code>txindex=1</code> in bitcoin.conf. You'll need to reindex.</p>

CC BY-SA 3.0
2016-05-31T18:40:38.457Z
I only do this to myself: Dave, RTFM! `getrawtransaction "txid" ( verbose )

NOTE: By default this function only works sometimes. This is when the tx is in the mempool
or there is an unspent output in the utxo for this transaction. To make it always work,
you need to maintain a transaction index, using the -txindex command line option.`
Dave Scotese
CC BY-SA 3.0
2016-05-30T21:02:57.400Z
2016-05-30T21:02:57.400Z
Pieter Wuille
<p>Hard to know without knowing your local machine state. My guess would be that you've downloaded the block headers (includes block information), but not the full blocks (which include transactions)</p>

CC BY-SA 3.0
2016-05-30T21:41:42.883Z
In that case, getblock would fail.
Pieter Wuille
CC BY-SA 3.0
2016-05-30T20:34:34.480Z
2016-05-30T20:34:34.480Z
Jimmy Song
<p>I got a block and asked for the data in its first transaction and that generated an error.  The following is from the console tab in the Debug window:</p>

<pre><code>10:52:52 getblock 000000000030bfd22ed67169b6bbf9ba994618fa9840642d395b56134f15176c

10:52:52
{
  "hash": "000000000030bfd22ed67169b6bbf9ba994618fa9840642d395b56134f15176c",
  "confirmations": 332460,
  "size": 216,
  "height": 81626,
  "version": 1,
  "merkleroot": "1ebda57ace225010d23d72619dbda5ee250dc4536f7c3428a9a419f06438ca54",
  "tx": [
    "1ebda57ace225010d23d72619dbda5ee250dc4536f7c3428a9a419f06438ca54"
  ],
  "time": 1285297753,
  "mediantime": 1285295165,
  "nonce": 71992579,
  "bits": "1b4766ed",
  "difficulty": 917.8307413015116,
  "chainwork": "00000000000000000000000000000000000000000000000000650ba70ddba016",
  "previousblockhash": "00000000001272fc0e0cfa9d08d854cfac681a939dccc21aecd9f7074fb0df2b",
  "nextblockhash": "00000000001bd5ac7329097b9888628c33c7adeecfc6e46f74fbab006f4c2127"
}

10:53:42 getrawtransaction 1ebda57ace225010d23d72619dbda5ee250dc4536f7c3428a9a419f06438ca54

10:53:42 No information available about transaction (code -5)
</code></pre>

<p>This happens in Bitcoin Classic and in Bitcoin Core.  I don't have a bitcoin.conf file in the folder where bitcoin-qt.exe lives, but I do have one where the chainstate and blocks folders are located.  It has five lines in it and each one starts with "addnode".</p>

<bitcoin-core><raw-transaction>
Why are some transactions unavailable in my debug window?
Dave Scotese
# Why are some transactions unavailable in my debug window?

(Asked by: username_0 on 2016-05-30)

I got a block and asked for the data in its first transaction and that generated an error. The following is from the console tab in the Debug window:

```
10:52:52 getblock 000000000030bfd22ed67169b6bbf9ba994618fa9840642d395b56134f15176c

10:52:52
{
  "hash": "000000000030bfd22ed67169b6bbf9ba994618fa9840642d395b56134f15176c",
  "confirmations": 332460,
  "size": 216,
  "height": 81626,
  "version": 1,
  "merkleroot": "1ebda57ace225010d23d72619dbda5ee250dc4536f7c3428a9a419f06438ca54",
  "tx": [
    "1ebda57ace225010d23d72619dbda5ee250dc4536f7c3428a9a419f06438ca54"
  ],
  "time": 1285297753,
  "mediantime": 1285295165,
  "nonce": 71992579,
  "bits": "1b4766ed",
  "difficulty": 917.8307413015116,
  "chainwork": "00000000000000000000000000000000000000000000000000650ba70ddba016",
  "previousblockhash": "00000000001272fc0e0cfa9d08d854cfac681a939dccc21aecd9f7074fb0df2b",
  "nextblockhash": "00000000001bd5ac7329097b9888628c33c7adeecfc6e46f74fbab006f4c2127"
}

10:53:42 getrawtransaction 1ebda57ace225010d23d72619dbda5ee250dc4536f7c3428a9a419f06438ca54

10:53:42 No information available about transaction (code -5)

```

This happens in Bitcoin Classic and in Bitcoin Core. I don't have a bitcoin.conf file in the folder where bitcoin-qt.exe lives, but I do have one where the chainstate and blocks folders are located. It has five lines in it and each one starts with "addnode".

**Tags:** bitcoin-core, raw-transaction


---

## 2 answers

### Answer by username_1 on 2016-05-30. Score: 2

You need the transaction index enabled of you want to use `getrawtransaction` on arbitrary transactions. By default, only transactions that have unspent outputs are available.

Run bitcoind with `-txindex` or put `txindex=1` in bitcoin.conf. You'll need to reindex.

> **Comments:**
> **username_0**: I only do this to myself: username_0, RTFM! `getrawtransaction "txid" ( verbose )  NOTE: By default this function only works sometimes. This is when the tx is in the mempool or there is an unspent output in the utxo for this transaction. To make it always work, you need to maintain a transaction index, using the -txindex command line option.`  

---

### Answer by username_2 on 2016-05-30. Score: 0

Hard to know without knowing your local machine state. My guess would be that you've downloaded the block headers (includes block information), but not the full blocks (which include transactions)

> **Comments:**
> **username_1**: In that case, getblock would fail.  

---

