1

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.

New contributor
Joey is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
8

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
    Nov 23 at 15:48

Your Answer

Joey is a new contributor. Be nice, and check out our Code of Conduct.

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.