<p>Since bitcoind/Bitcoin-qt 0.8, no transaction index is kept anymore by default, as it is not necessary for validation in the new database model.</p>

<p>Instead, there is only a database of unspent transaction outputs, which has enough information to (slowly) locate transactions in block files. <code>getrawtransaction</code> uses this, but it only works for transactions that are not yet spent in the block chain.</p>

<p>If you want to be able to look up historical transactions, you need to set the <code>txindex=1</code> configuration option (or start with the <code>-txindex</code> command line flag). As this setting can only be set when the database is created, you'll need to rebuild it from scratch (using <code>-reindex</code>).</p>

CC BY-SA 3.0
2013-04-05T00:04:13.333Z
Thanks! i'm doing it right now, how much time should the process last?. "bitcoind.exe -reindex" is the way to do it right?
user3418
CC BY-SA 3.0
2013-04-05T00:11:57.973Z
"bitcoind.exe -reindex" will do the trick, if you've set txindex=1 in bitcoin.conf. It may take half an hour to several hours, depending on hardware.
Pieter Wuille
CC BY-SA 3.0
2013-04-05T00:17:48.557Z
Yes i did that, i guess i will sit back and wait for the command line to tell me something, i will come back to you when it's done. Thanks!
user3418
CC BY-SA 3.0
2013-04-05T20:13:21.367Z
As noted in bitcointalk thread - it doesn't work for some strange reason on the very first bitcoin transaction
http://blockexplorer.com/tx/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
Karel Bílek
CC BY-SA 3.0
2013-04-05T23:33:04.543Z
That is perfectly normal, as the coinbase of the genesis block does not actually exist from the point of view of the block validation rules. It is not known whether this is a bug or intentional, but this transaction was never added to any database, so it can't be spent. However, this can't be safely changed right now (that would technically be a hard fork...).
Pieter Wuille
CC BY-SA 3.0
2014-03-08T21:59:39.830Z
@PieterWuille could you explain why a full tx index is no longer kept? For example, without the tx index how is bitcoind able to keep track of what is an unspent output vs an output that has been spent?
samol
CC BY-SA 3.0
2014-03-08T22:36:36.223Z
By keeping a separate compact database with just the unspent outputs of transactions.
Pieter Wuille
CC BY-SA 3.0
2013-04-04T23:01:34.317Z
2013-04-04T23:01:34.317Z
Pieter Wuille
<p>I'm trying to read raw transactions but there is a problem; Seems like getrawtransaction only works for recent transactions, old transactions give me the next error:</p>

<pre><code>No information available about transaction (code -5)
</code></pre>

<p>Why is that? How can i see raw transactions from old transactions? When i say "old" its like from 5 days ago. I really need those transactions to get the sender addresses for each one, if "aging" is the case i can keep that data in my own database before it gets old but...Maybe it's not about old/new transactions, maybe there is another factor that won't let me read some raw transactions, you guys know something about that?</p>

<p>Here's how I'm using the command:</p>

<p>Working:</p>

<pre><code>getrawtransaction 94628caff8b926f1247779aa687fc5cce5063f3389f291192ce1e52fae9a2655 1
</code></pre>

<p>Not working:</p>

<pre><code>getrawtransaction 6e0f6cc64a08241c62eb93427923e95319c1e16db56ddeefa0c837944ce63d4b 1
</code></pre>

<p>Thank you!</p>

CC BY-SA 3.0
2013-04-04T22:00:47.597Z
Is this from BitcoinJ or the standard client?
Nick ODell
CC BY-SA 3.0
2013-04-04T22:05:06.083Z
It's from Bitcoind and Bitcoin-qt debug console. I sincerely don't know about BitcoinJ.
user3418
CC BY-SA 3.0
2013-04-04T22:09:51.243Z
Can you give us the command you're running?
Nick ODell
CC BY-SA 3.0
2013-04-04T22:12:41.333Z
getrawtransaction 94628caff8b926f1247779aa687fc5cce5063f3389f291192ce1e52fae9a2655 1
user3418
CC BY-SA 3.0
2013-04-04T22:13:45.697Z
getrawtransaction 6e0f6cc64a08241c62eb93427923e95319c1e16db56ddeefa0c837944ce63d4b 1
user3418
CC BY-SA 3.0
2013-04-04T22:15:10.820Z
This may sound like an is-it-plugged-in question, but is there a transaction that hashes out to that? blockchain.info doesn't seem to know about it.
Nick ODell
CC BY-SA 3.0
2013-04-04T22:15:14.763Z
Those are two examples, the first one is a new transaction and it works, the second one is an old transaction and brings me the error, both transactions are testnet transactions. both were used on the debug console of bitcoin-qt
user3418
CC BY-SA 3.0
2013-04-04T22:16:04.143Z
Yup, thats because those are testnet transactions.
user3418
<bitcoin-core><testnet><rpc-error-5>
getrawtransaction error? [Code -5]
user3418
# getrawtransaction error? [Code -5]

(Asked by: username_0 on 2013-04-04)

I'm trying to read raw transactions but there is a problem; Seems like getrawtransaction only works for recent transactions, old transactions give me the next error:

```
No information available about transaction (code -5)

```

Why is that? How can i see raw transactions from old transactions? When i say "old" its like from 5 days ago. I really need those transactions to get the sender addresses for each one, if "aging" is the case i can keep that data in my own database before it gets old but...Maybe it's not about old/new transactions, maybe there is another factor that won't let me read some raw transactions, you guys know something about that?

Here's how I'm using the command:

Working:

```
getrawtransaction 94628caff8b926f1247779aa687fc5cce5063f3389f291192ce1e52fae9a2655 1

```

Not working:

```
getrawtransaction 6e0f6cc64a08241c62eb93427923e95319c1e16db56ddeefa0c837944ce63d4b 1

```

Thank you!

**Tags:** bitcoin-core, testnet, rpc-error-5

> **Comments:**
> **username_1**: Is this from BitcoinJ or the standard client?  
> **username_0**: It's from Bitcoind and Bitcoin-qt debug console. I sincerely don't know about BitcoinJ.  
> **username_1**: Can you give us the command you're running?  
> **username_0**: getrawtransaction 94628caff8b926f1247779aa687fc5cce5063f3389f291192ce1e52fae9a2655 1  
> **username_0**: getrawtransaction 6e0f6cc64a08241c62eb93427923e95319c1e16db56ddeefa0c837944ce63d4b 1  
> **username_1**: This may sound like an is-it-plugged-in question, but is there a transaction that hashes out to that? blockchain.info doesn't seem to know about it.  
> **username_0**: Those are two examples, the first one is a new transaction and it works, the second one is an old transaction and brings me the error, both transactions are testnet transactions. both were used on the debug console of bitcoin-qt  
> **username_0**: Yup, thats because those are testnet transactions.  

---

## 1 answers

### Answer by username_2 on 2013-04-04. Score: 24 | Accepted answer

Since bitcoind/Bitcoin-qt 0.8, no transaction index is kept anymore by default, as it is not necessary for validation in the new database model.

Instead, there is only a database of unspent transaction outputs, which has enough information to (slowly) locate transactions in block files. `getrawtransaction` uses this, but it only works for transactions that are not yet spent in the block chain.

If you want to be able to look up historical transactions, you need to set the `txindex=1` configuration option (or start with the `-txindex` command line flag). As this setting can only be set when the database is created, you'll need to rebuild it from scratch (using `-reindex`).

> **Comments:**
> **username_0**: Thanks! i'm doing it right now, how much time should the process last?. "bitcoind.exe -reindex" is the way to do it right?  
> **username_2**: "bitcoind.exe -reindex" will do the trick, if you've set txindex=1 in bitcoin.conf. It may take half an hour to several hours, depending on hardware.  
> **username_0**: Yes i did that, i guess i will sit back and wait for the command line to tell me something, i will come back to you when it's done. Thanks!  
> **username_3**: As noted in bitcointalk thread - it doesn't work for some strange reason on the very first bitcoin transaction http://blockexplorer.com/tx/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b  
> **username_2**: That is perfectly normal, as the coinbase of the genesis block does not actually exist from the point of view of the block validation rules. It is not known whether this is a bug or intentional, but this transaction was never added to any database, so it can't be spent. However, this can't be safely changed right now (that would technically be a hard fork...).  
> **username_4**: @username_2 could you explain why a full tx index is no longer kept? For example, without the tx index how is bitcoind able to keep track of what is an unspent output vs an output that has been spent?  
> **username_2**: By keeping a separate compact database with just the unspent outputs of transactions.  

---

