<p>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?"</p>

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

CC BY-SA 3.0
2014-02-06T14:32:34.790Z
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
CC BY-SA 3.0
2014-02-06T14:41:57.150Z
@jiahmark: Right, and the answer is "it makes no difference."
Nate Eldredge
CC BY-SA 3.0
2014-02-06T14:51:18.220Z
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
CC BY-SA 3.0
2014-02-06T16:26:37.660Z
@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.
Meni Rosenfeld
CC BY-SA 3.0
2017-10-09T11:13:14.790Z
@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?
David Schwartz
CC BY-SA 3.0
2014-02-06T13:58:53.993Z
2014-02-06T13:58:53.993Z
Luca Matteis
<p>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.</p>

CC BY-SA 3.0
2018-01-12T14:45:17.773Z
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.
Petar Donchev
CC BY-SA 3.0
2014-02-06T14:52:02.213Z
2014-02-06T14:52:02.213Z
Tim S.
<p>Mining programs typically start with a nonce of 0 and then increment after every attempt.</p>

CC BY-SA 3.0
2015-03-10T23:38:05.940Z
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
CC BY-SA 3.0
2015-03-11T06:35:06.287Z
And you say "typically." Which mining program's don't start at 0?
Geremia
CC BY-SA 3.0
2015-03-11T06:51:15.860Z
And don't ASICs determine the starting value themselves?
Geremia
CC BY-SA 3.0
2015-03-15T11:43:03.607Z
@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.
Meni Rosenfeld
CC BY-SA 3.0
2014-02-06T16:24:22.727Z
2014-02-06T16:24:22.727Z
Meni Rosenfeld
<p><strong>EDIT:</strong> 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.</p>

<p>STarting with a nonce zero is then a valid choice.</p>

<hr>

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

<p>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. </p>

<p><strong>So, back to mining:</strong> 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, <em>do not start with nonce 0 unless you own or participate in a pool with a lot of hashpower</em>.</p>

<p>You would better start with a random nonce, so that:</p>

<ul>
<li>You have a better chance to be the first one to a solution (unless you're the majority miner)</li>
<li>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)</li>
</ul>

<p>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 </p>

CC BY-SA 3.0
2017-10-07T08:18:57.640Z
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.
dave_thompson_085
CC BY-SA 3.0
2017-08-11T09:57:56.060Z
2017-10-09T10:00:35.017Z
2017-10-09T10:00:35.017Z
PPC
<p>When the miner program start, the value of nonce is zero or a random number? Which of them is better?</p>

CC BY-SA 3.0
2014-02-07T01:05:31.420Z
This question appears to be off-topic because the info is available on the Bitcoin wiki. https://en.bitcoin.it/wiki/Nonce
John T
CC BY-SA 3.0
2014-02-10T08:19:54.240Z
@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.
Greg Hewgill
<nonce>
What value should nonce be when mining bitcoin ?
jiahmark
# What value should nonce be when mining bitcoin ?

(Asked by: username_0 on 2014-02-06)

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

**Tags:** nonce

> **Comments:**
> **username_1**: This question appears to be off-topic because the info is available on the Bitcoin wiki. https://en.bitcoin.it/wiki/Nonce  
> **username_2**: @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.  

---

## 4 answers

### Answer by username_3 on 2014-02-06. Score: 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.

> **Comments:**
> **username_0**: 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  
> **username_4**: @username_0: Right, and the answer is "it makes no difference."  
> **username_0**: 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  
> **username_5**: @username_0: 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.  
> **username_6**: @username_0 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?  

---

### Answer by username_7 on 2014-02-06. Score: 4

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.

> **Comments:**
> **username_8**: 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.  

---

### Answer by username_5 on 2014-02-06. Score: 2

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

> **Comments:**
> **username_9**: 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?"  
> **username_9**: And you say "typically." Which mining program's don't start at 0?  
> **username_9**: And don't ASICs determine the starting value themselves?  
> **username_5**: @username_9: 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.  

---

### Answer by username_10 on 2017-08-11. Score: -2

**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 username_0, then indeed, you lost for that block. But nobody can know that beforehand in a random process, so you don't really care

> **Comments:**
> **username_11**: 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.  

---

