I was a bit confused by your saying miners "claim" their reward. I know miners claim the mining rewarding by generation transactions with outputs to their own addresses. But as to the transaction fees, does it simply work in the way that the
transaction fee=input sum-output sum
and this difference goes as money belong to the block of specific miners?
I might be making mistakes and please correct me if I did. Thanks.
Miners claim their reward by creating a generation transaction that has no inputs and that assigns one or more outputs.
The protocol limits the value of the sum of the outputs in the generation transaction to be less than or equal to the sum of the block subsidy (currently 25 BTC) AND the transaction fees of all transactions that the miner includes in the block.
The sum of the transaction fees of all transactions in the block can be calculated as the sum of all inputs in the block minus the sum of all non-generation outputs in the block. Another way to look at it is that the sum of all output in the block (including the generation transaction) must be less than or equal to the sum of the block subsidy AND all the inputs in the block.