How to get the input address from an txid with bitcoind

1

1

I want to get the input addresses of a transaction with a known id. If I use getrawtransaction I get something like:

"vin" : [
{
"txid" : "470a499101b7042b225dab4f15fa252cdc7f3a16153e33d66d0c8c53b1d83aaa",
"vout" : 1,
"scriptSig" : {
"asm" : "304502206917b333161de796bed7770615ebf66669092a53877b3dba2582bad7dfc0b56c022100f9926a5e82d15666122b1f8703d94116eec0c98ddbf922a72467b05953532e1a01 03864670304932f91c85f38e80aebcd6c37fa36529b7135f7fa21b36585df5ab49",
"hex" : "48304502206917b333161de796bed7770615ebf66669092a53877b3dba2582bad7dfc0b56c022100f9926a5e82d15666122b1f8703d94116eec0c98ddbf922a72467b05953532e1a012103864670304932f91c85f38e80aebcd6c37fa36529b7135f7fa21b36585df5ab49"
},

If I want to further look of the transaction 470a499101b7042b225dab4f15fa252cdc7f3a16153e33d66d0c8c53b1d83aaa with getrawtransaction I get a: "No information availabe about transaction (code -5)"

So is it at all possible to get the input addresses of a random transaction (not belonging to your wallet) with bitcoind?

user599464

Posted 2015-04-09T03:50:05.573

Reputation: 436

Answers

1

You need to pass the option -txindex=1 at the command line, or include txindex=1 in bitcoin.conf.

Nick ODell

Posted 2015-04-09T03:50:05.573

Reputation: 26 536

and than I can look up transactions where all outputs are already spend, right?user599464 2015-04-09T14:29:13.053

1

Yes, you can. Open bitcoind with -txindex=1 If you didn't use txindex=1, you might need to add -reindex to recreate transactions indice. Therefore, you can use getrawtransaction to look up spent transactions which are not belonging to you.

mhchia

Posted 2015-04-09T03:50:05.573

Reputation: 31