Bitcoin Forum

Other => Beginners & Help => Topic started by: skubeedooo on August 30, 2011, 04:28:16 PM



Title: Retrieving Senders address
Post by: skubeedooo on August 30, 2011, 04:28:16 PM
Is it possible to retrieve the senders address from bitcoind?

I can see it in blockexplorer.com but don't see it in the bitcoind api.  Also, while blockexplorer gives the senders address, it doesn't say how many confirmations there have been, and doesn't appear to be part of the documented api for blockexplorer.  Is there a tool I can use where I specify the receivers address and it will tell me all the incomming transactions along with number of confirmations in a machine-readable format?

Thanks




Title: Re: Retrieving Senders address
Post by: Revalin on September 02, 2011, 07:31:17 AM
I assume you're trying to automatically decide if a sale can be marked as paid.  Try doing it like so:

Customer makes a purchase.  You generate a sales order number, 00001.
API: getaccountaddress sale-00001  >> returns: address
You invoice the customer and provide that address.
Customer pays.
API: getreceivedbyaccount sale-00001 6  >> returns: 0 (since we don't have 6 confirms yet)
Wait a while.
API: getreceivedbyaccount sale-00001 6  >> returns: 20 (You're paid!)
Ship the goods.

You can also check:
listreceivedbyaccount  >> returns: array of account records, select the one you want
getreceivedbyaddress  6 >> returns: total received to that address with at least 6 confirms


Title: Re: Retrieving Senders address
Post by: skubeedooo on September 02, 2011, 11:34:04 AM
Thanks for the reply, but no, I'm actually trying to get the address that sent the money.  Later I will be sending money back to that address, kind of like bit lotto does (although I hadn't heard of bitlotto when I made this post).


Title: Re: Retrieving Senders address
Post by: bitlotto on September 02, 2011, 12:37:04 PM
Thanks for the reply, but no, I'm actually trying to get the address that sent the money.  Later I will be sending money back to that address, kind of like bit lotto does (although I hadn't heard of bitlotto when I made this post).
To work you HAVE TO BE SURE that certain conditions are met: they only send the BTC running software on their computer and that they are still using the same wallet and haven't deleted it or moved on to a new one.


Title: Re: Retrieving Senders address
Post by: Revalin on September 02, 2011, 02:39:54 PM
I see.  I don't think that can be done with the API.

You could use the API to find the transaction ID and confirms, and then query blockexplorer for the transaction ID.  You'd have to parse the HTML since I don't think their API does what you need either.

Note that a transaction can (and frequently will) have multiple "from" addresses.  Also, if they're using a wallet service, the coins might come from the service's common pool - so if you send it back, the service wouldn't know which user to credit.


Title: Re: Retrieving Senders address
Post by: danystatic on November 24, 2013, 06:37:31 PM
I do have a similar system going on... {other msg: maybe we could talk about this? }

I am asking the user to POST their desired receivers address because I am not able to extract the address from the payment.

Here's what I have:
I am receiving BTC from couple of friends now !! :) looking to do a  btc-startup

please some advice or help...

Note: using jsonRPCClient and PHP (the basic process could be similar to others lang..  I believe)

The website asks them to POST their address before sending, because I am not able to extract automatically the Senders Address.

1.  Create a new address for each sender, using ->getnewaddress('payments');

2.  Then I listen for payment with -->getreceivedbyaddress()
     This way I do not obtain any information about the Tx

3. Find the txid  ?? how?

4. While a better method is found, using ->listtransactions() to read a received tx

5. I can see the senders address is inside this array, How can I be sure I extract the "correct" senders address without comparing it with the one POSTed via the website?