Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: No_2 on September 16, 2016, 11:42:20 AM



Title: How do miner's spend their fees (not the block reward)?
Post by: No_2 on September 16, 2016, 11:42:20 AM
What do the transactions on the blockchain look like where a miner spends their fees - not the block reward of 50/25/12.5 BTC they have earned per block but the fees users have paid for each transaction to be mined to a block? How are these referenced by the next transaction because fees are not specified in a transaction output?

I understand that a miner states the amount of bitcoin they wish to receive as a reward in the coinbase transaction for a block (they are even able to specify a lower reward than the maximum permitted by the network). They can then spend the outputs from the coinbase by referencing it in the next transaction. But how are the fees the miner received for all the transactions in that block spent?


Title: Re: How do miner's spend their fees (not the block reward)?
Post by: DannyHamilton on September 16, 2016, 01:06:38 PM
The block reward (paid to the miner in the output of the coinbase transaction) is required to be less than or equal to the sum of the block subsidy (currently 12.5 BTC) plus all the transaction fees of all the transactions included in the block.

So, the miner spends the fees by spending the block reward.  The fees are already in there.  If a block has a total of 0.17 BTC in fees, then the miner will pay themselves 12.67 BTC in the block reward (12.5 BTC subsidy plus 0.17 BTC fees).


Enforcing this requirement can be done by adding up the values of ALL the outputs from ALL the transactions in the block (including the coinbase transaction) and making sure that sum is not greater than the sum of the current block subsidy (12.5 BTC) plus ALL of the inputs of ALL of the transactions in the block.


Title: Re: How do miner's spend their fees (not the block reward)?
Post by: Carlton Banks on September 17, 2016, 01:11:30 AM
From what I remember, the fees and the block subsidy are merged into a single output. So 0.17 BTC fees would create a single coinbase output of 12.67 BTC for the miner, to be spent like any other output.


Title: Re: How do miner's spend their fees (not the block reward)?
Post by: No_2 on September 20, 2016, 11:18:12 AM
Right makes sense. Thanks everyone.


Title: Re: How do miner's spend their fees (not the block reward)?
Post by: No_2 on October 04, 2016, 12:39:56 PM
Actually - one more question: If a miner does not specify the full miners' fees they are entitled to are the BTC lost?

I'm guessing the answer is no as the next block would be entitled to pick up these missing BTC, as long as it doesn't exceed the total permitted BTC for that block depth?


Title: Re: How do miner's spend their fees (not the block reward)?
Post by: achow101 on October 04, 2016, 12:50:27 PM
Actually - one more question: If a miner does not specify the full miners' fees they are entitled to are the BTC lost?

I'm guessing the answer is no as the next block would be entitled to pick up these missing BTC, as long as it doesn't exceed the total permitted BTC for that block depth?
IIRC if the miner does not specify the full reward (subsidy and fee) then whatever they missed will be lost. This has happened before; a miner (midnightmagic I think) missed one satoshi in the rewards so now that satoshi is permanently lost.


Title: Re: How do miner's spend their fees (not the block reward)?
Post by: DannyHamilton on October 04, 2016, 03:25:08 PM
Actually - one more question: If a miner does not specify the full miners' fees they are entitled to are the BTC lost?

Correct.  Permanently lost.  Those bitcoins simply cease to exist.  There is no way to get them back without a hard fork and consensus of the vast majority of users (which isn't going to happen just because some stupid miner forgot to pay himself his full reward).

This has happened before; a miner (midnightmagic I think) missed one satoshi in the rewards so now that satoshi is permanently lost.

More than one satoshi has been lost this way.  The last I looked (back in July 2014) there were about 135.2 BTC that were completely missing form the UTXO.  Some of those are probably in OP_RETURN outputs, but I think quite a few of them are from a miner that failed to pay himself his full reward (due to a bug in his mining software).


Title: Re: How do miner's spend their fees (not the block reward)?
Post by: FrilledShark on October 04, 2016, 03:46:48 PM
More than one satoshi has been lost this way.  The last I looked (back in July 2014) there were about 135.2 BTC that were completely missing form the UTXO.  Some of those are probably in OP_RETURN outputs, but I think quite a few of them are from a miner that failed to pay himself his full reward (due to a bug in his mining software).
A few example: block  71036 (https://blockexplorer.com/block/00000000000997f9fd2fe1ee376293ef8c42ad09193a5d2086dddf8e5c426b56), which is missing the transaction fees, 0.03 BTC. (Look at: "Unparsed address")
also the one by midnight magic. (Below)

This has happened before; a miner (midnightmagic I think) missed one satoshi in the rewards so now that satoshi is permanently lost.
You are almost correct, he wrote about it here: https://bitcointalk.org/index.php?topic=7253.msg184414#msg184414.
It was more then one satoshi, as he also underpaid himself by the transaction fee. He lost 1 satoshi + 0.01 BTC (fee). He was (might still be) the only one to ever have claimed less then the block reward (Bugs making the coinbase unspendable doesn't count). Other have forgotten to claim transaction fees, but always credited themselves the full block reward.

Edit: And if you want to read more about lost bitcoins, there is a thread dedicated to it. Contains a couple of early bugs (As earlier stated by Danny) and stupid mistakes by people.
https://bitcointalk.org/index.php?topic=7253.0