# What value should nonce be when mining bitcoin ?

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

• This question appears to be off-topic because the info is available on the Bitcoin wiki. en.bitcoin.it/wiki/Nonce 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

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 Commented Feb 6, 2014 at 14:32
• @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 Commented Feb 6, 2014 at 14:51
• @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.

• 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?" Commented Mar 10, 2015 at 23:38
• And you say "typically." Which mining program's don't start at 0? Commented Mar 11, 2015 at 6:35
• And don't ASICs determine the starting value themselves? Commented Mar 11, 2015 at 6:51
• @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.