Post
Topic
Board Bitcoin Technical Support
Re: How to figure out from which addresses i received a transaction?
by
rabit
on 05/01/2013, 00:01:51 UTC
Just if someone has the same problem in the future, this script should find one of the addresses:

#!/bin/bash

rawtx=$(bitcoind getrawtransaction $1 1)

vin="${rawtx#*'"'vin'"' : [}"
vin="${vin%'"'vout'"' : [*}"


rtx="${vin#*txid'"' : '"'}"
rtx="${rtx%%'"'*}"
ro="${vin#*vout'"' : }"
ro="${ro%%,*}"
rtx=$(bitcoind getrawtransaction $rtx 1)
rvout="${rtx#*vout'"' : [}"
rvout="${rvout%'"'blockhash*}"
rvout="${rvout#*value}"
n="${rvout#*'"'n'"' : }"
n="${n%%,*}"
while [ "$n" != "$ro" ]; do
   rvout="${rvout#*value}"
   n="${rvout#*'"'n'"' : }"
   n="${n%%,*}"
done
rad="${rvout#*addresses'"' : [}"
rad="${rad#*'"'}"
rad="${rad%%'"'*}"
echo $rad