Post
Topic
Board Beginners & Help
Re: Why does transaction works this way??
by
Mia Chloe
on 15/06/2024, 15:45:35 UTC
I've been curious about why transaction had to deal with spending of all inputs on a particular address.
Although I'm not new to the fact that all transaction  have to be spent in a single output  buy why does it have to work that way??
So the change I'm  receiving  can I call it an output  or a new input ??
If it's not on a new address but on the same address(the received  UTXO), will it be counted as part of inputs along with other input when I want to send again  to a new address.
Just like hosseinimr93 mentioned, from my experience with making Bitcoin transactions, when you make a transaction, your wallet automatically checks for addresses in your HD wallet which can be able to pay for the whole transaction with a single output. During the process of the transaction, the remaining coins from that address you spent from is moved to a new address as an input known as the change address.
Think of it as giving a shop owner a $5 bill to pay for an item of $3 now you will be given a change of $2 after the purchase. In this case the $2 is the change returned to the change address while the $3 is the spent UTXO .

In addition, if a single address can't pay for a particular transaction, the wallet will pick from as many addresses possible moving them as a single output to an address, then the compiled coins in the new address is used as a second output to pay for the transaction.