Bitcoin Forum

Other => Beginners & Help => Topic started by: geopolisch on April 28, 2013, 06:11:18 PM



Title: q: transactions with bitcoin-qt, and choosing the sending address
Post by: geopolisch on April 28, 2013, 06:11:18 PM
I already asked this but got no solution (or not one that I understood) so I'll try again. I also have a new question.

1 -------------------------

From my address 15sJQqE2dEGi5dLQi4MyDw5ZQ4HKzT7P3d, I transferred 0,86 BTC to 162HWpt9njiDsk5nwGixw7fDPuNy55Kh9X with a commission of 0,001 BTC.

Here is the transaction: https://blockchain.info/tx/d60a39fadd551b2dae9d487dbc69f30ab9ebb46b1abd62dad75f23674bafff23

At the time I had 0.9531 BTC in total. And surprisingly (for me at least!) it sent the remaining money in my wallet (0.0921 BTC) to some unknown address 1Nu8Y6krpe31Snu7fW8TJHcAkDHKc1onQ1.

Anyone knows why is this?

2 -------------------------

Also with bitcoin 1.8.1b-Qt, how do you choose the address from which the money is going to be sent?

Thanks!


Title: Re: q: transactions with bitcoin-qt, and choosing the sending address
Post by: vm1990 on April 28, 2013, 07:01:04 PM
1 its very confusing but bitcoins arnt like normal currencys but in basic terms its like giving $10 to someone and getting change back (sorry but it really is confusing to explain) bitcoin dosnt do straight transactions for some reason it was designed to always use lumps so you effectivly send the money the wallet rounds it off and you get the correct change back to stick your wallet at the correct amount

2. as far as i know you can if your default address has enough btc to complete a transaction then that the address it uses

if you have multiple addresses then the wallet will sum up whats available and in no single address has enough it will take chunks from each address to make up the amount you want to send

hope this helps and sorry for 1 i read about it and my head nearly exploded


Title: Re: q: transactions with bitcoin-qt, and choosing the sending address
Post by: DannyHamilton on April 29, 2013, 03:59:10 AM
From my address 15sJQqE2dEGi5dLQi4MyDw5ZQ4HKzT7P3d, I transferred 0,86 BTC to 162HWpt9njiDsk5nwGixw7fDPuNy55Kh9X with a commission of 0,001 BTC.

Here is the transaction: https://blockchain.info/tx/d60a39fadd551b2dae9d487dbc69f30ab9ebb46b1abd62dad75f23674bafff23

At the time I had 0.9531 BTC in total. And surprisingly (for me at least!) it sent the remaining money in my wallet (0.0921 BTC) to some unknown address 1Nu8Y6krpe31Snu7fW8TJHcAkDHKc1onQ1.

Anyone knows why is this?

This is the "change" from the transaction:

With the way bitcoin works, you can't partially spend a previous output that you received.  It has to be completely spent.  So, if you receive 10 BTC all in a single transaction from someone/somewhere at an address, then that address now has a single 10 BTC output.

Later if you want to send 2 BTC to somebody, the program can use the previous 10 BTC output as an input into the transaction, and create a 2 BTC output to the address where you want to send it.  This leaves 8 BTC leftover in the transaction.  If you don't send those 8 BTC somewhere, then they become miner fees and end up in the coinbase transaction of the new block for the miner to keep.  If you don't want to give those 8 BTC away as fees to the miner, then you need to include a second output in your transaction sending the 8 BTC back to your own wallet.  As an analogy, think of pulling a $10 bill out of your pocket to pay for something that costs $2, you get $8 back in "change".

The way Bitcoin-Qt does this is to create a new bitcoin address that it doesn't tell you about and keeps track of that address and the associated private key in your wallet.dat.  Since this isn't an address that you requested in the "Receive Coins" tab of the user interface, it doesn't show up in that list.  Bitcoin-Qt knows about the address since it is in the wallet.dat file, so it includes it in the balance that it shows you.  Bitcoin-Qt uses a new change address for every transaction.  So if you create 10 different transactions, each sending bitcoins somewhere, then your wallet will have used 10 different change addresses (although some of them may be empty if Bitcoin-Qt used the bitcoins associated with some of those address as inputs into other transactions).

Also with bitcoin 1.8.1b-Qt, how do you choose the address from which the money is going to be sent?

Bitcoin-Qt does not have the ability to choose which outputs are used as inputs to your transactions.  That responsibility is entirely managed by the wallet itself.  There is a "coin control" wallet based on Bitcoin-Qt code that someone created that does allow you the ability to choose outputs to spend. You can probably find it if you search the bitcointal forum for "coin control".

The only other thing you might be able to do to choose a "sending address" with Bitcoin-QT would be to send the entire balance of your wallet to that address, and then send the amount you want to transfer to whatever address you are trying to pay.