When the miner program start, the value of nonce is zero or a random number? Which of them is better?

  • 1
    This question appears to be off-topic because the info is available on the Bitcoin wiki. en.bitcoin.it/wiki/Nonce
    – John T
    Commented Feb 7, 2014 at 1:05
  • @JacobTorba: I'm not sure that availability on the Bitcoin wiki qualifies a question for closing here. There would be an awful lot more closed questions if that were the case. Commented Feb 10, 2014 at 8:19

4 Answers 4


This is essentially like asking: "When buying a lottery ticket is it better to have a zero or a random number in my lottery number?"

The reality is that it actually doesn't matter because it's an entirely random process, just like winning the lottery.

  • what i mean is that the miner program start by 0 and increase if the hash is not match , or start by random number and increase if the hash is not match
    – jiahmark
    Commented Feb 6, 2014 at 14:32
  • 1
    @jiahmark: Right, and the answer is "it makes no difference." Commented Feb 6, 2014 at 14:41
  • How about that the answer of nonce is smaller than the random number , the miner will never find answer because the value of nonce will only increase , the miner have to waste computation power until long-polling come
    – jiahmark
    Commented Feb 6, 2014 at 14:51
  • 3
    @jiahmark: After the nonce range is exhausted, extraNonce is incremented. Every nonce/extraNonce combination has the same probability of being valid. The chance to miss a valid nonce is exactly offset by the chance to skip a range of invalid nonces and get faster to a valid range. Commented Feb 6, 2014 at 16:26
  • @jiahmark Why do you say the value of the nonce will only increase? When you hit the maximum possible nonce value, do you think you just stop? Commented Oct 9, 2017 at 11:13

It doesn't matter where you start. The block you're hashing is unique because it's the only one that includes the mining bounty (new coins and transaction fees) being payed to your address. A timestamp is also included, so every second, you could start the nonce over at 0 and increment.

  • Very useful comment - if all miners were mining the same block, there would be some advantage to start randomly (and move randomly), because if you move deterministically, the mist powerful miner would win every time. Commented Jan 12, 2018 at 14:45

Mining programs typically start with a nonce of 0 and then increment after every attempt.

  • 1
    This answer actually answers the question. Others were talking about how the starting nonce doesn't matter, but the question is: "What does a miner choose for the first nonce value?"
    – Geremia
    Commented Mar 10, 2015 at 23:38
  • And you say "typically." Which mining program's don't start at 0?
    – Geremia
    Commented Mar 11, 2015 at 6:35
  • And don't ASICs determine the starting value themselves?
    – Geremia
    Commented Mar 11, 2015 at 6:51
  • 1
    @Geremia: Probably all programs start at 0. But I don't know for a fact that there is not a single one that starts at another value, and nothing is stopping a program from starting at another value, hence I've weakened the claim with "typically". And yes, ASIC devices iterate over nonces internally, and they, too, probably all start at 0. Commented Mar 15, 2015 at 11:43

EDIT: dave_thompson_085's note below just proved me wrong, as the block hash will depend on your coinbase TXN, and will most probably be different from other miner's.

STarting with a nonce zero is then a valid choice.

This assertion is no more than a semi-educated guess, but IMO it does matter, a lot what your starting guess is.

Just imagine playing a lottery where you choose your ticket number. Choosing a popular number (such as the current year) would give you exactly the same probability to be chosen as a winner than choosing a rare number (say: a random number avoiding obvious choices). But when it comes to sharing the prize you will definitely want to be a single winner instead of having to split prize with other winners.

So, back to mining: if you mine with a nonce of 0, and there is another miner around with more hashpower than you, also starting with a nonce of 0; and if a solution is to be found that is close to 0, they will find it before you. As such, do not start with nonce 0 unless you own or participate in a pool with a lot of hashpower.

You would better start with a random nonce, so that:

  • You have a better chance to be the first one to a solution (unless you're the majority miner)
  • Whenever all the possible solutions for a block lie far from nonce 0, the network will not have to wait for all miners to reach it, and will thus perform better (more regularly, not clogging on a 30-minutes-block that will start to pile unprocessed transactions)

As a side note, if the only available solution is lower than your starting nounce, as suggested by jiahmark, then indeed, you lost for that block. But nobody can know that beforehand in a random process, so you don't really care

  • 2
    At current difficulty you have to scan the entire range of nonces for millions of extranonce values and it doesn't matter what starting nonce you use. Choosing a good starting extranonce would help in theory but is impossible: which extranonces are 'lucky' depends on your coinbase txn thus differs for every miner in a way that can't be computed. Commented Oct 7, 2017 at 8:18

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.