Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: ETSAH on May 06, 2017, 09:22:50 AM



Title: Question about transaction
Post by: ETSAH on May 06, 2017, 09:22:50 AM
I have sent 0.02 BTC from my address to a address where I wanted to deposit
I am using bitcoin core

This is the tx:
https://blockchain.info/tx/23a133145509e61c9defb29869d08c0915b685f10ec0994649ccac245805e89c

The address i sent from has ~0.25BTC

Why is in my tx another address, which receives 0.08BTC ?
Where can I see this address in my Bitcoin core wallet ?
I assume it is my change, but why is my change not 0.25 - 0.02 ?


Title: Re: Question about transaction
Post by: ranochigo on May 06, 2017, 12:42:58 PM
Why is in my tx another address, which receives 0.08BTC ?
That is the change address, the remainder of your coins are sent after deducting amount to your intended recipient and fees.
Where can I see this address in my Bitcoin core wallet ?
It isn't displayed in the UI. You need to go Help>Debug Window> Console and key in 'listaddressgroupings'. You should be able to see all your addresses.
I assume it is my change, but why is my change not 0.25 - 0.02 ?

Your wallet doesn't use the entire UXTO in the address for every transaction. It analyses and select the input which is most suitable for it. In this case, your wallet chose the input https://blockchain.info/tx-index/233438884/1 to spend from. If you press 'show script and coinbase', you should be able to see it.

Your change is the total amount of inputs* - given as fee - the total amount of the outputs.

* Huge mistake on my part. Thanks HCP for correcting me. (More proof reading in the future i guess :D)


Title: Re: Question about transaction
Post by: HCP on May 06, 2017, 02:56:46 PM
I assume it is my change, but why is my change not 0.25 - 0.02 ?

Your wallet doesn't use the entire UXTO in the address for every transaction. It analyses and select the input which is most suitable for it. In this case, your wallet chose the input https://blockchain.info/tx-index/233438884/1 to spend from. If you press 'show script and coinbase', you should be able to see it.

Your change is the total amount spent/given as fee - the total amount of the inputs.
Ummmm close... but backwards ;)

Change = Total Amount of Inputs - (Total Amount spent + Mining Fee)

Also... just to clarify why your change isn't 0.25 - 0.02...

The address you sent from: 14m5YnAypdnEdYo35qNRB6FC88fJgGpAmV (https://blockchain.info/address/14m5YnAypdnEdYo35qNRB6FC88fJgGpAmV) had 2 inputs in it... one for ~0.14 and one for ~0.101... because you're only spending 0.02, the wallet does not need to use both of those inputs... so it picked one (most wallets try to use the smallest inputs first)... and it chose the ~0.101 input...

Thus, your change is = ~0.101 - (~0.2 + 0.0002) => ~0.8 ;)

If you had tried to spend say 0.12, your wallet would have probably tried to use the ~0.14 input in the transaction... and if you had tried to send ~0.2, it would have had to use both inputs.