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.

Murch
  • 75,206
  • 34
  • 186
  • 622
Yangrui
  • 657
  • 1
  • 6
  • 12

1 Answers1

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
  • 105,497
  • 9
  • 194
  • 308
  • So if I don't have an extra address and forget to create output, then I would lose the fund forever correct? – Yangrui Nov 05 '16 at 07:06
  • 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 Nov 05 '16 at 07:07