Author

Topic: How to figure out from which addresses i received a transaction? (Read 1154 times)

legendary
Activity: 1652
Merit: 1016
Another Satoshi Dice spinoff on it's way
kjj
legendary
Activity: 1302
Merit: 1026
Ok, let me say this plain and clear, for the thousandth time:

There is no FROM address in the bitcoin system.  You are asking a question that is without meaning in the system.  The software you are writing will not do what you think it does, even if it appears to work more-or-less correctly most of the time.

Can you give me an example when this wont work if the transaction is sent from a client like bitcoin-qt?

It depends what you mean by "work".  I haven't read your script in detail, but I'm willing to take it on faith that it is capable of finding one or all of the pubkeys that previously controlled one or all of the inputs of the transaction that was sent.  In that sense, it can probably "work".

On the other hand, no one cares about that.  They want a return address where winnings or refunds can be sent.  And the bitcoin system has no concept for that.  Transactions do not identify people or entities, only keys.  And keys do not identify people or entities either.  In this sense, this won't "work" when the bitcoin-qt that the payment is sent from is not owned by the person nominally making the payment, for example if I make the payment for someone else.
member
Activity: 62
Merit: 10
Ok, let me say this plain and clear, for the thousandth time:

There is no FROM address in the bitcoin system.  You are asking a question that is without meaning in the system.  The software you are writing will not do what you think it does, even if it appears to work more-or-less correctly most of the time.

Can you give me an example when this wont work if the transaction is sent from a client like bitcoin-qt?
kjj
legendary
Activity: 1302
Merit: 1026
Ok, let me say this plain and clear, for the thousandth time:

There is no FROM address in the bitcoin system.  You are asking a question that is without meaning in the system.  The software you are writing will not do what you think it does, even if it appears to work more-or-less correctly most of the time.
legendary
Activity: 873
Merit: 1000
I need it for a service i´m programming atm.

one more dice or roulette game, coming up!   that's what i'm guessing.
member
Activity: 62
Merit: 10
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
member
Activity: 62
Merit: 10
Thanks, so there is no easier way than the one sketched in the first post (analyzing the txids of vin and trying to determine which outputs of the txids where used for the transaction)?

Edit: I just found out that the vout parameter in the vin txids is a reference to which output of the txid was used, so the above way works easy enough for me...
member
Activity: 62
Merit: 10
Are you exploring the concept out of curiosity, or do you actually have a need to identify a list of addresses associated with the previous outputs that were used as inputs in any given transaction?

I need it for a service i´m programming atm.
legendary
Activity: 3472
Merit: 4801
I try to figure out the easiest way for identifyiung the addresses from which a transaction was sent with bitcoind and bash.

The only way i can think off is looking at getrawtransaction of the transaction and then analyzing the txids of vin. This solution is a little bit complicated and i want to know if there is a better way.

Are you exploring the concept out of curiosity, or do you actually have a need to identify a list of addresses associated with the previous outputs that were used as inputs in any given transaction?

I only ask because, this isn't the first time this question has been asked, and generally when people ask this question they have a misunderstanding about what they can identify with that list of addresses, or what the best practices are for sending bitcoins back to someone who sends them bitcoins.
member
Activity: 62
Merit: 10
I try to figure out the easiest way for identifyiung the addresses from which a transaction was sent with bitcoind and bash.

The only way i can think off is looking at getrawtransaction of the transaction and then analyzing the txids of vin. This solution is a little bit complicated and i want to know if there is a better way.
Jump to: