This question already has an answer here:

I'm looking into the structure of blocks in the Bitcoin blockchain, and I can't figure out when\how the fees collected by miner of the blocks are transferred to the miner. According to what I can tell they are not a part of the coinbase transaction (which as I understand has to be constant since changing it after discovering a block would change the hash of the block). Are the fees paid as separate a transaction? Are they written directly to the UTXO without appearing on the blockchain? Something else?


marked as duplicate by Andrew Chow Nov 4 '18 at 18:24



The coinbase transaction itself has the subsidy/coins for mine a block + all fees of the transactions of that block.

  • Thanks! If this is the case, how is this implemented in a way which does not change the hash of the block once it's filled out? – MayaD Nov 4 '18 at 19:42
  • @MayaD The entire contents of the (candidate) block, including the subsidy payout, is determined before mining even begins. Nothing can be modified about a block afterwards, as it would invalidate the proof of work. When a miner wants to update the contents of the block they're working on, mining continues by working on a new, updated, block candidate. – Pieter Wuille Nov 7 '18 at 6:43
  • Thanks again! If this is the case, is there a way of determining which part of the fee paid to user x came from user y? Do you maybe have a reference to the relevant place in the source code? – MayaD Nov 12 '18 at 18:53
