lian / bitcoin-ruby

bitcoin utils and protocol in ruby.
Other
922 stars 322 forks source link

How do I correctly use the second output that sends remaining btc back to me? #314

Closed Matthiasclee closed 2 years ago

Matthiasclee commented 2 years ago

Let's say my address contains 1 btc, over several transactions. If I want to send 0.7 BTC to another address with a 0.1 BTC miner fee, do I put the 0.7 BTC in the first output, and then put 0.2 BTC in the second one to leave 0.1 BTC as a fee? If that is the case, does it matter that the tx in prev_out only had a value of 0.05 BTC outputted to my address and/or was already spent?