Transaction change calculation I'm confused about how exactly I should compute a change for transactions.
Say, for a given address I have 4 unspent outputs containing 2 BTC each and I want to send 5 BTC to other address.

Here's what I do:


Find 3 outputs needed so the total is 6 BTC
Now, what should the change be? 6-5=1 or 8-5=3?
The change is anything that's left over when you take the outputs you'll be spending, subtract the value of the transaction sent, and subtract fees. Since transactions should be as small as possible, as few outputs as needed will be spent. In your case, 3 outputs will be spent, no fee is in place, so the following new outputs will be created:


5 BTC to recipient
1 BTC to a change address.