Bitcoin Forum
May 05, 2024, 11:39:27 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to figure out from which addresses i received a transaction?  (Read 1141 times)
rabit (OP)
Member
**
Offline Offline

Activity: 62
Merit: 10


View Profile
January 04, 2013, 09:52:36 PM
 #1

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.
1714909167
Hero Member
*
Offline Offline

Posts: 1714909167

View Profile Personal Message (Offline)

Ignore
1714909167
Reply with quote  #2

1714909167
Report to moderator
Make sure you back up your wallet regularly! Unlike a bank account, nobody can help you if you lose access to your BTC.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
January 04, 2013, 10:40:40 PM
 #2

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.
rabit (OP)
Member
**
Offline Offline

Activity: 62
Merit: 10


View Profile
January 04, 2013, 10:42:43 PM
 #3

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.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4616



View Profile
January 04, 2013, 10:47:05 PM
 #4

See these discussions:

https://bitcointalk.org/index.php?topic=134217.0

https://bitcointalk.org/index.php?topic=40279.0
rabit (OP)
Member
**
Offline Offline

Activity: 62
Merit: 10


View Profile
January 04, 2013, 10:58:32 PM
Last edit: January 04, 2013, 11:09:15 PM by rabit
 #5

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...
rabit (OP)
Member
**
Offline Offline

Activity: 62
Merit: 10


View Profile
January 05, 2013, 12:01:51 AM
 #6

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
koin
Legendary
*
Offline Offline

Activity: 873
Merit: 1000


View Profile
January 05, 2013, 03:28:16 AM
 #7

I need it for a service i´m programming atm.

one more dice or roulette game, coming up!   that's what i'm guessing.
kjj
Legendary
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
January 05, 2013, 04:37:16 AM
 #8

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.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
rabit (OP)
Member
**
Offline Offline

Activity: 62
Merit: 10


View Profile
January 05, 2013, 11:12:51 AM
 #9

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
*
Offline Offline

Activity: 1302
Merit: 1024



View Profile
January 05, 2013, 12:44:44 PM
 #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?

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.

17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8
I routinely ignore posters with paid advertising in their sigs.  You should too.
Buffer Overflow
Legendary
*
Offline Offline

Activity: 1652
Merit: 1015



View Profile
January 10, 2013, 03:52:02 PM
 #11

Another Satoshi Dice spinoff on it's way

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!