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

CC BY-SA 4.0
2018-11-04T19:42:49.867Z
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
CC BY-SA 4.0
2018-11-07T06:43:36.387Z
@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
CC BY-SA 4.0
2018-11-12T18:53:56.537Z
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
CC BY-SA 4.0
2018-11-04T18:09:45.003Z
2018-11-04T18:09:45.003Z
Aitorjs
<p>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?</p>

<p>Thanks!</p>

<blockchain><transaction-fees>
How are transaction fees collected in Bitcoin?
MayaD
# How are transaction fees collected in Bitcoin?

(Asked by: username_0 on 2018-11-04)

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?

Thanks!

**Tags:** blockchain, transaction-fees


---

## 1 answers

### Answer by username_1 on 2018-11-04. Score: 1

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

> **Comments:**
> **username_0**: 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?  
> **username_2**: @username_0 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.  
> **username_0**: 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?  

---

