How can I use a large input if the difference of the outputs and the inputs goes to the fee?

1

I'm confused by how exactly Bitcoin transaction are calculated. A transaction contains inputs and outputs, and if its inputs exceed its outputs the difference is deemed as the transaction fee.

So, if I just mined a block and received 25 coins in reward, there were no previous transactions related with my address and I want to make a transfer of 0.001 Btc using my 25 Btc balance. Then, there will be a 25 Btc input and a 0.001 Btc output, and the difference in the amount of 24.999 Btc all goes to miners?! Please help me understand.

Yangrui

Posted 2016-11-05T03:37:24.880

Reputation: 477

related: How does change work in a bitcoin transaction?

Murch 2016-11-05T08:46:28.853

Answers

2

You would create a transaction with two outputs, one being 0.001 BTC to the recipient, another being 24.9989 back to another key you own yourself (called a change output), and the difference of 0.0001 BTC would be fee.

Pieter Wuille

Posted 2016-11-05T03:37:24.880

Reputation: 54 032

So if I don't have an extra address and forget to create output, then I would lose the fund forever correct?Yangrui 2016-11-05T07:06:24.363

Yes, if you forget to add a change output, it will become fee. Bitcoin Core will actually refuse to send transactions that pay too much fee, to protect against this.Pieter Wuille 2016-11-05T07:07:30.573