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?


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.