3

If I understand correctly, when calculating a proof of work, the entire header is being used in a sha256 function.

Now, whenever a new transaction is added to a pre-mined block, the header completely changes due to the merkle root hash changing.

Doesn't this mean that every new transaction added to the block will reset the calculation effort due to the initial header constantly changing?

For example, let's say I will need approximately 10,000 calculations in order to get a proof of work. If I get to 5,000 calculations and then the initial data (header hashes) changes, will this mean that I will need to calculate 10,000 more times to get the proof of work?

If that's the case, why even bother adding transactions to the block and not just rush creating an empty block ASAP, saving the time and effort of adding more data to the block?

Basically, I'm trying to understand why adding transactions to a block does not have a negative effect on the effort of being the first one getting a proof of work.

I hope I'm explaining myself clearly.

2
  • also empty block would obviously lack transactional fee rewards Commented Dec 15, 2021 at 17:11
  • 1
    At the time of this writing, average transaction fees in a block are only 1.27% of the block reward. If including transactions in the block would reduce the chance to find a good hash, all miners would happily ignore the transactions and what they gain from them.
    – X. N.
    Commented Dec 15, 2021 at 18:16

1 Answer 1

12

This is a common misconception: mining is progress free.

Yes, it may take 10000 hashes in your example on average to find a block, but this only means that every attempt has 1/10000 chance of being a good one. It is irrelevant how many hashes you've done so far. Even if you have performed 9999 hashes already, the next one still only has a 1/10000 chance.

So the key to understanding this paradox is that while indeed, adding a transaction is a "reset" in a sense, every hash attempt is a reset, as it is independent from what you've done so far.

1
  • 1
    That's a perfect explanation. Thanks!
    – Joey
    Commented Nov 23, 2021 at 15:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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