0

The block header contains a number of things, among them the Merkle root hash. Wouldn't this mean that every time a new transaction is added to the block (before its mined), that all nonces previously attempted need to be tried yet again?

Wouldn't this discourage miners from adding transactions to the block if they have to hash everything with nonces again?

Also, is it possible that no nonces could produce a valid successful/winning hash?

4
  • You may want to consider breaking up this into multiple questions. The third and fourth questions, in particular, don't directly relate to the overall question.
    – Jestin
    Dec 11, 2017 at 15:10
  • Sometimes miner's will mix up the transactions on purpose to get a new hash if they aren't able to find a valid nonce in a reasonable amount of time. Dec 11, 2017 at 16:17
  • Hi @Jestin, as suggested, I've removed the forth question but I still think the 3rd question relates as per my other comment. Cheers.
    – alexkb
    Dec 12, 2017 at 12:07
  • @alexkb, the point isn't to have related questions grouped correctly. The point is to have questions be independent posts so that people with the same question can find it easier. Each of these could have been independent, and therefore simpler for someone to find in the future.
    – Jestin
    Dec 12, 2017 at 13:14

2 Answers 2

2

Wouldn't this mean that every time a new transaction is added to the block (before its mined), that all nonces previously attempted need to be tried yet again?

Yes, but "need" is a bit too strong of a word in this context. Because you can't predict the outcome of a hash without performing the hash, each new hash attempt is just as likely to meet the target as the previous one. As such, yes, it is possible that a nonce that has already been attempted will now succeed given that the merkle root has changed...but it is no more likely than the nonce you were about to attempt before adding the new transaction. There's no real reason to re-try nonces. The odds aren't any better.

Wouldn't this discourage miners from adding transactions to the block if they have to hash everything with nonces again?

No. Because the odds do not change, there is no negative incentive to adding a new transaction. However, transactions come with miner fees, so the positive incentive is still in place.

Also, is it possible that no nonces could produce a valid successful/winning hash?

Yes, it is possible, although not probable. Remember that a successful hash is one that is less than the target. These means there are quite a large number of nonces that will be successful, however, as a set they represent a very small proportion of the total possible nonces. Even if hypothetically there is a block header that is "unmineable", a competing block would not be. A block will still be found, and it will likely have a very similar set of transactions in it.

1
  • Great answer(s), thank you. I think the key take away is that just because a miner has performed a hash that was unsuccessful doesn't increase their chances of finding the winning hash with the next nonce - this is because there's no guarantee that any nounce with a Merkle root hash will be the winning hash. Have I got that right?
    – alexkb
    Dec 12, 2017 at 12:03
0

There are no transactions dynamically added to a block that miners try to solve.
Transactions are taken from mempool in the moment the last block was mined and the merkelroot has to be calculated only once for those picked transactions.

It´s every miners free choice to discard transactions from this list (e.g. tx with low fees) and the list is limited by the 1MB blocksize. So it´s approximately 2000 tx per block.

Your Answer

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

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