0

Say I have two addresses in my bitcoin core wallet, address A contains 0.1 BTC and address B contains 0.15

I choose to transfer someone 0.1 BTC, but there is also some fee, say 0.00001. Will the transfer take the BTC from address A and the fee from address B, so no BTC change (UTXO) will be received after the transaction?

Or the case is that, since the transfer + fee > 0.1 it will actually be taken from address B so there will be BTC change of 0.15-0.1-0.00001 = 0.04999 ?

1 Answer 1

5

Addresses are not account balances from which BTC amounts are deducted from. Addresses are only shorthand specifiers for an output script. The amount actually comes from UTXOs, each of which has a script which may correspond to an address.

The address the amount being spent (including fees) will "come from" depends on the UTXOs. Address A could have a balance of 0.1 BTC, but this could be composed of several UTXOs whose amounts sum to 0.1. The same applies to address B.

If there are only 2 UTXOs, one for address A of 0.1 BTC, and one for address B of 0.15 BTC, then the transaction will likely contain one input of the UTXO for address B and create a change output. UTXOs cannot be partially spent, so if the UTXO for A is chosen, then the UTXO for B must also be chosen as A does not have enough to cover the fee. This will also result in a change output.

The only scenario where there is no change output is if there are multiple UTXOs for each address and these can be combined in some way to sum to exactly the amount being sent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.