When does miner insert the coinbase transaction?

2

When a miner creates the candidate block with transactions from the mempool, does he insert the coinbase transaction after winning the PoW or during PoW?

monkeyUser

Posted 2019-04-08T09:43:12.767

Reputation: 770

Answers

4

If you add the coinbase transaction later, that will change the merkle root. If merkle root is changed, the block header is changed and hence the header hash you calculated earlier is no longer valid. This is why the coinbase transaction needs to be entered before you start calculating the hash of the header.

Ugam Kamat

Posted 2019-04-08T09:43:12.767

Reputation: 6 378