<p>When it's used <a href="https://en.bitcoin.it/wiki/Nonce" rel="nofollow">as it's intended to</a>, the nonce usually begins at a certain point and increments from there. This can restart every second, since there is a second-specific timestamp in the block, but modern ASICs can do far more than 2^32 hashes per second, so it seems reasonable that nonces should be distributed fairly evenly.</p>

<blockquote>
  <p>may a miner force a mined block to have a specific nonce? (if his hashrate allows him to)</p>
</blockquote>

<p>Yes. He'd do this by fixing his block header's nonce and changing transactions instead (the coinbase transaction, a.k.a. block reward, is a perfect place for this); by changing any transaction, the <a href="https://en.bitcoin.it/wiki/Protocol_specification#Merkle_Trees" rel="nofollow">Merkle root</a> in the block header will change.</p>

<p>The usual mining loop only takes two SHA256 hashes per attempt. If you only include the coinbase transaction in your block, this will add (at least; I'm unsure if it'd have to fill out 1 to be an even number, as it does for 3) two SHA256 hashes per attempt, meaning you'd be (at least) twice as slow as normal. I'm also unsure whether existing ASICs are capable of doing this different calculation.</p>

<p>The number of hashes would grow with (proportional to the logarithm of) the number of transactions in the block. If you include just 2 more transactions (so I can mirror the <a href="https://en.bitcoin.it/wiki/Protocol_specification#Merkle_Trees" rel="nofollow">example at the wiki</a>). You'd have to do 3 double-hashes to rebuild the Merkle root (there are 7 double-hashes total, but some of them could be reused) before your double-hash of the block header, for a total of 8 SHA256 hashes (1/4th your normal speed).</p>

CC BY-SA 3.0
2014-08-01T15:32:13.697Z
What do you mean with "having his nonce entirely within the transactions"? I could mine a block containing a single transaction and a set of arbitrary nonces until I guess a valid hash containing one of them?
Damiano Barbati
CC BY-SA 3.0
2014-08-01T15:44:35.070Z
Normally, there are [two nonces](https://en.bitcoin.it/wiki/Block_hashing_algorithm): the one in the block header, and an extraNonce in the coinbase transaction. If you choose to keep the nonce in the block header fixed, you need to change *something* (most likely the extraNonce) after every attempt.
Tim S.
CC BY-SA 3.0
2014-08-01T15:47:21.237Z
I've updated my answer and comment to better address this.
Tim S.
CC BY-SA 3.0
2014-08-02T09:29:50.910Z
Thanks Tim, very complete answer. Then I can assume nobody can predict or hash an arbitrary nonce.
Damiano Barbati
CC BY-SA 3.0
2014-08-01T15:14:32.467Z
2014-08-01T15:44:55.463Z
2014-08-01T15:44:55.463Z
Tim S.
<p>No it is not predictable. If it was that would break how block discovery works.</p>

<p>To explain in very broad terms: a nonce is simply an incrementing number. It is combined with a random set of as yet unconfirmed transactions and passed through a simple hashing algorithm, which turns it into a long number called a hash.</p>

<p>It's this answer (the hash) that has to match the test : it needs to begin with a certain number of zeros for the block of transactions to have been considered "discovered", and hence confirmed. </p>

<p>If it does not match this test, the nonce is incremented by and the process begins again.</p>

<p>It is the fact that the number and content of the transactions combined with the nonce supplies the <em>essential unpredictability</em> of the process, meaning that ultimately nobody can say which miner will find the block.</p>

<p>As this is quite a heavy computing task (to continuously try new nonces and transactions until you find the block) the nonce also serves another purpose : to help other bitcoin nodes take a shortcut to check if the block you claim you discovered is correct. They simply need to take all the transactions in the block (you have to tell them which ones) and use the nonce to arrive at the correct Hash with the right number of zeros. This by contrast is a very light computing task. </p>

CC BY-SA 3.0
2014-08-01T10:34:18.783Z
2014-08-01T10:34:18.783Z
T9b
<p>Is the block nonce predictable in any way? It seems to be a proof of work on his own just like the block hash, but may a miner force a mined block to have a specific nonce? (if his hashrate allows him to)</p>

<blockchain><nonce>
Block nonce predictable
Damiano Barbati
# Block nonce predictable

(Asked by: username_0 on 2014-08-01)

Is the block nonce predictable in any way? It seems to be a proof of work on his own just like the block hash, but may a miner force a mined block to have a specific nonce? (if his hashrate allows him to)

**Tags:** blockchain, nonce


---

## 2 answers

### Answer by username_1 on 2014-08-01. Score: 1 | Accepted answer

When it's used [as it's intended to](https://en.bitcoin.it/wiki/Nonce), the nonce usually begins at a certain point and increments from there. This can restart every second, since there is a second-specific timestamp in the block, but modern ASICs can do far more than 2^32 hashes per second, so it seems reasonable that nonces should be distributed fairly evenly.

> may a miner force a mined block to have a specific nonce? (if his hashrate allows him to)

Yes. He'd do this by fixing his block header's nonce and changing transactions instead (the coinbase transaction, a.k.a. block reward, is a perfect place for this); by changing any transaction, the [Merkle root](https://en.bitcoin.it/wiki/Protocol_specification#Merkle_Trees) in the block header will change.

The usual mining loop only takes two SHA256 hashes per attempt. If you only include the coinbase transaction in your block, this will add (at least; I'm unsure if it'd have to fill out 1 to be an even number, as it does for 3) two SHA256 hashes per attempt, meaning you'd be (at least) twice as slow as normal. I'm also unsure whether existing ASICs are capable of doing this different calculation.

The number of hashes would grow with (proportional to the logarithm of) the number of transactions in the block. If you include just 2 more transactions (so I can mirror the [example at the wiki](https://en.bitcoin.it/wiki/Protocol_specification#Merkle_Trees)). You'd have to do 3 double-hashes to rebuild the Merkle root (there are 7 double-hashes total, but some of them could be reused) before your double-hash of the block header, for a total of 8 SHA256 hashes (1/4th your normal speed).

> **Comments:**
> **username_0**: What do you mean with "having his nonce entirely within the transactions"? I could mine a block containing a single transaction and a set of arbitrary nonces until I guess a valid hash containing one of them?  
> **username_1**: Normally, there are [two nonces](https://en.bitcoin.it/wiki/Block_hashing_algorithm): the one in the block header, and an extraNonce in the coinbase transaction. If you choose to keep the nonce in the block header fixed, you need to change *something* (most likely the extraNonce) after every attempt.  
> **username_1**: I've updated my answer and comment to better address this.  
> **username_0**: Thanks Tim, very complete answer. Then I can assume nobody can predict or hash an arbitrary nonce.  

---

### Answer by username_2 on 2014-08-01. Score: 3

No it is not predictable. If it was that would break how block discovery works.

To explain in very broad terms: a nonce is simply an incrementing number. It is combined with a random set of as yet unconfirmed transactions and passed through a simple hashing algorithm, which turns it into a long number called a hash.

It's this answer (the hash) that has to match the test : it needs to begin with a certain number of zeros for the block of transactions to have been considered "discovered", and hence confirmed.

If it does not match this test, the nonce is incremented by and the process begins again.

It is the fact that the number and content of the transactions combined with the nonce supplies the *essential unpredictability* of the process, meaning that ultimately nobody can say which miner will find the block.

As this is quite a heavy computing task (to continuously try new nonces and transactions until you find the block) the nonce also serves another purpose : to help other bitcoin nodes take a shortcut to check if the block you claim you discovered is correct. They simply need to take all the transactions in the block (you have to tell them which ones) and use the nonce to arrive at the correct Hash with the right number of zeros. This by contrast is a very light computing task.


---

