Author

Topic: How to know the addresses that have sent BTCs to an address? (Read 750 times)

member
Activity: 80
Merit: 10
First, there is no from address. You should just about never be using the previous address coins were sent to as anything resembling a "from" address. However, to make that code snippet work, you need to have Bitcoin's txindex option on -- and enabling that requires a reindex. If you're willing to reindex, stop bitcoind, and then start it again with -txindex and -reindex. You should only need to do this once. This makes it create an index of all transactions, rather than just unspent ones.
F-J
newbie
Activity: 2
Merit: 0
Hi,

I need to know which BTC addresses have sent BTCs to one of my addresses.

I've googled and have saw some advices that the way to go is by the Transaction ID, but I'm not getting on how to do it.

For example, to get my last transaction, I do:
Code:
listtransactions '*' 1 0


I will get:
Code:
{
"account" : "",
"address" : "XXXXxxxXXxxxXXxxxxxxxXX",
"category" : "receive",
"amount" : 0.1111,
"confirmations" : 111,
"blockhash" : "00000000000000000000000000000000000000000000000",
"blockindex" : 111,
"blocktime" : 111111111111,
"txid" : "555555555555555555555555555555555555555555555555555",
"time" : 11111111111,
"timereceived" : 11111111111
}

I saw this example here (http://bitcoin.stackexchange.com/questions/3896/how-to-findout-the-sender-of-a-transaction):
Code:
txid =
addresses = []
raw_tx = decoderawtransaction(getrawtransaction(txid))
for(input in raw_tx['vin']) {
  input_raw_tx = decoderawtransaction(getrawtransaction(input['txid']))
  addresses.push(input_raw_tx['vout'][input['vout']]['scriptPubKey']['addresses'][0])
}

This code above fails me in this line "input_raw_tx = decoderawtransaction(getrawtransaction(input['txid']))" when getting the "getrawtransaction(input['txid'])"

The error is code -5

Any clues on how to do this?


Thanks
Jump to: