Bitcoin Forum

Other => Beginners & Help => Topic started by: erik777 on March 22, 2013, 05:58:31 PM



Title: bitcoin-qt return addresses
Post by: erik777 on March 22, 2013, 05:58:31 PM
if a user sends coins to the return address on a transaction, will it always go to the sender (presuming that the sender is still running the same client and wallet)?


Title: Re: bitcoin-qt return addresses
Post by: DannyHamilton on March 22, 2013, 06:21:05 PM
if a user sends coins to the return address on a transaction, will it always go to the sender (presuming that the sender is still running the same client and wallet)?

What return address?  Bitcoin doesn't have return addresses.

If you send bitcoin to a randomly selected address from one of the inputs in the transaction, the person with the private key to that address will "receive" the bitcoins.  That person may, or may not, be the "sender" of the bitcoins depending on how they sent them and what wallet they are using.


Title: Re: bitcoin-qt return addresses
Post by: erik777 on March 23, 2013, 04:41:06 AM
if a user sends coins to the return address on a transaction, will it always go to the sender (presuming that the sender is still running the same client and wallet)?

What return address?  Bitcoin doesn't have return addresses.

If you send bitcoin to a randomly selected address from one of the inputs in the transaction, the person with the private key to that address will "receive" the bitcoins.  That person may, or may not, be the "sender" of the bitcoins depending on how they sent them and what wallet they are using.

Perhaps I should of said "Sender address", which I anticipate mainstream users will interpret as the "reply-to address".   

Let me rephrase:

Before diving into bitcoinj, I'm trying to do testing to fully understand the behaviour and limitation of bitcoin and its clients.

So, I have Bitcoin Qt running on Linux with coinage, and Bitcion Wallet by Andreas
Schildbach running on Android.  The latter uses bitcoinj 0.8.

To test micropayments, I sent 0.01 with a tiny fee to the tablets.  On the tablet, it showed the sender address as being one of three addresses I had setup under the Receive Coins tab of Qt on the desktop.  First question:  With three to choose from how did it pick this address?  The receiver address on the tablet transaction details was not the address the coins were sent to.

I then sent another 0.01 without a fee, and it arrived OK in the tablet.  But, not only did the the sender address not match any of the three in the Qt client, that address was what was the receiver address in the first 0.01 address.  How is this possible?



Title: Re: bitcoin-qt return addresses
Post by: CIYAM on March 23, 2013, 04:52:34 AM
Perhaps I should of said "Sender address", which I anticipate mainstream users will interpret as the "reply-to address".  

There really is no such thing - there are only UTXOs (which could either be from "coinbase" on from one or more previously unspent outputs that was part of someone's "wallet" whose output addresses generally are not anything that would or should be known to the the recipient).

In short if you want to determine who sent you a payment then create a unique payment address for them to pay to (the software and indeed the protocol are not designed to do this).


Title: Re: bitcoin-qt return addresses
Post by: theymos on March 23, 2013, 05:09:22 AM
It's not recommended. SatoshiDice does it, but notice that they have this warning:

Quote
Only use wallets that allow you to receive Bitcoin from the same address you sent from. If you're not sure, test with .001 Bitcoins. If you get nothing back, then your wallet is not compatible.

If you do "auto-refunds" without a similar warning, people will lose money and be very angry.


Title: Re: bitcoin-qt return addresses
Post by: DannyHamilton on March 23, 2013, 05:14:56 AM
If you want to be able to send bitcoin to someone, the proper and only reliable way to do it is for you to provide them with a way to tell you what address they want the bitcoins sent to.  If you try to guess what address to use based on some analysis of a transaction that you receive from them, you will manage in most cases to get lucky and guess at an address that will end up with bitcoins being delivered to their wallet, but you will fail and end up with bitcoins somewhere unintended often enough to at best soil the reputation of your service and quite possibly increase your costs in dealing with the situation.


Title: Re: bitcoin-qt return addresses
Post by: DannyHamilton on March 23, 2013, 05:22:19 AM
- snip -
First question:  With three to choose from how did it pick this address?
- snip -

The wallet spends a previously received output in entirety.  If the other tow addresses hadn't received any bitcoins then the previous output that was spent was the one that was sent to that address that you saw.

The receiver address on the tablet transaction details was not the address the coins were sent to.

This is unlikely.  You'd have to provide details (bitcoin addresses, transactionIDs) for me to identify what you were actually seeing, but I suspect that the transaction had two outputs, one to the address the coins were sent to and another to send the change back to a newly created (and hidden from you) "change" address in Bitcoin-Qt.

I then sent another 0.01 without a fee, and it arrived OK in the tablet.  But, not only did the the sender address not match any of the three in the Qt client, that address was what was the receiver address in the first 0.01 address.  How is this possible?

As has been explained, there is no "sender address" there is only a previously unspent output.  The output that you are referring to as the "sender address" was the "change" from the first transaction being sent back to Bitcoin-Qt.  In the second transaction, this change output is then spent.  When Bitcoin-Qt creates a "change" address, it keeps track of it for you in the wallet.dat file but doesn't tell you about that new address in the user interface.