In bitcoin, miners hash the header twice with the SHA256 function. This header consists of the fields listed below:

  • version (v)
  • previousHashBlock (p)
  • merkleRoot (m)
  • time (t)
  • difficulty (d)
  • nonce (n)

Let's simplify and say that I am a pool miner with nonce range from 1-100. So if I do my share and find that on 9th minute the Nonce value of 91, solves the puzzle (proof of work). But by the time I send to network, merkleRoot and time has changed, so the nonce that I've found is not true anymore. We know that hash changes dramatically with slightest change of input, but in this formula, not one but TWO variable change constantly throughout my mining period (in this case 9 minute). Transaction occured and time changed. So how does this formula hold true thoughout the mining time?

SHA256(v + p + m + t + d + n(91)) => 0000000asd8f686asd6das

Where m and t changes constantly? Wouldn't 91 be irrelevant at the time of finding?

2 Answers 2


Realistic miners run through all 2^32 possible nonces in much less than a second.

If a transaction occurred after you started your nonce search, then your block won't include that transaction. There's no problem with that.

If the time changed after you mined your block, then your block won't have the exact right time. Again, no problem with that.

And if you think about it, there can't be any problem with that. How would anyone know when you mined the block or whether the transaction occurred before or after you mined the block? It's mining that allows bitcoin to agree on these things, so if you mined the block, you're the one who gets to choose.

  • where does 2^32 comes from? is it the max possible nonce? or is it agreed share of the pool mining? if it take only a second, what do I do the rest of 10 minutes?
    – Prostak
    Commented Jan 22, 2018 at 23:52
  • There are 2^32 possible nonces since the nonce is 32-bits. Perhaps you have the misconception that there's one magic block that every miner is trying to mine. A miner is trying to mine any valid block that pays him the reward. If he can't mine a particular block, he'll just trying again with a slightly different block. If he has lots of fast hardware, he may be trying to mine 100's of possible different blocks at once. On average, someone somewhere succeeds once every 10 minutes. That's how hard mining is. Commented Jan 22, 2018 at 23:53
  • thanks for responding btw! you are right, I did have this misconception... but does it mean, that it might be impossible to find jackpot with certain criterias.... i mean, it just does not exist... so let's say i have m and t, and no matter of nonce i use, it is impossible to get a hash with certain 0? so that means, that you have to modify time or merkleRoot ?
    – Prostak
    Commented Jan 22, 2018 at 23:59
  • @Prostak Right. It's trivial to get a new merkleRoot by just slightly changing the transaction that pays you the mining reward. So that gets you a whole new block to try all 2^32 nonces on. Commented Jan 23, 2018 at 0:09
  • When you say "100's of possible different blocks at once", what do you mean? what variants do they introduce to block? time? and change transaction list? or is there a way to modify smth else?
    – Prostak
    Commented Jan 23, 2018 at 0:23

As a miner, you choose your own merkleRoot and time.

This is the same reason why different miners are looking for different nonces - your merkleRoot contains your reward transaction, while the merkleRoot for a different miner contains their reward transaction.

  • what do you mean "you choose"? do you mean that you choose transactions to pick to the block? but in that case, you also don't choose, because you have to take transactions that occurred before... as I understand, the max transactions are 2400, so you have to take at least this max
    – Prostak
    Commented Jan 22, 2018 at 23:55
  • You don't have to take transactions that occurred before. You have your choice of valid transactions. And you can introduce your own transactions if you want. Mining is how we agree on which transactions occurred so if you mine a block, you get to choose for that block. So long as they're valid, of course. Commented Jan 22, 2018 at 23:56
  • Yes, I mean that miners choose the transactions that they would like to include in a block. This how miners can drive transaction costs up, by choosing to only include transactions with high included transaction fees. If miners were somehow required to include the oldest transactions, then nobody would bother including any transaction fees. Commented Jan 22, 2018 at 23:56
  • @DavidSchwartz correct me if I am wrong, but you have to pick transactions BEFORE you start picking the nonce? because merkleRoot changes the result? in other words, if you mined the successful nonce, you can't change transactions list after? so you have to pick the exact transactions before starting to mine?
    – Prostak
    Commented Jan 23, 2018 at 0:06
  • @GregHewgill same question pls ^^
    – Prostak
    Commented Jan 23, 2018 at 0:07

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.