17

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!

8
  • Is this from BitcoinJ or the standard client?
    – Nick ODell
    Commented Apr 4, 2013 at 22:00
  • It's from Bitcoind and Bitcoin-qt debug console. I sincerely don't know about BitcoinJ.
    – user3418
    Commented Apr 4, 2013 at 22:05
  • Can you give us the command you're running?
    – Nick ODell
    Commented Apr 4, 2013 at 22:09
  • getrawtransaction 94628caff8b926f1247779aa687fc5cce5063f3389f291192ce1e52fae9a2655 1
    – user3418
    Commented Apr 4, 2013 at 22:12
  • getrawtransaction 6e0f6cc64a08241c62eb93427923e95319c1e16db56ddeefa0c837944ce63d4b 1
    – user3418
    Commented Apr 4, 2013 at 22:13

1 Answer 1

24

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).

7
  • 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
    Commented Apr 5, 2013 at 0:04
  • "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. Commented Apr 5, 2013 at 0:11
  • 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
    Commented Apr 5, 2013 at 0:17
  • As noted in bitcointalk thread - it doesn't work for some strange reason on the very first bitcoin transaction blockexplorer.com/tx/… Commented Apr 5, 2013 at 20:13
  • 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...). Commented Apr 5, 2013 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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