<h2>Previous block hash</h2>
<blockquote>
<p>When mining a block, who gets to choose the hash from the previous block,</p>
</blockquote>
<p>Nobody.</p>
<p>It isn't <em>chosen</em>. The current top block in the chain is known and its contents are fixed. The hash value depends only on the contents. Therefore the hash of the current top block is also a fixed value.</p>
<p>A good cryptographic hash algorithm, such as SHA256, produces a value that cannot be predicted from the data being hashed. Other than by doing all the work of actually computing the hash. Changing one bit in the data makes the hash result wildly different in a completely unpredictable way. The hashes look completely random.</p>
<hr />
<h2>Nonce</h2>
<blockquote>
<p>how do they not know the correct answer to the nonce if they are the once who set it up?</p>
</blockquote>
<p>Nonces are not things that have an answer.</p>
<p>The nonce is just a numeric data item whose value has no meaning. It is provided for the miner's use as described below.</p>
<hr />
<h2>Hashes &amp; Nonces in Mining</h2>
<p>Lets look at the role of block-hashes and nonces in mining:</p>
<p>A new block has a header that contains a reference to the previous block. When creating their block template a miner must set the previous block reference to the block-id (hash) of the current top block in the chain of blocks. This is necessary for their new block to become the next top block of the chain. Each block links to the previous block.</p>
<p>Then the miner computes a hash of their new block and if the resulting hash value is higher than the network target the arrangement of data is a failure and they must change something in their block template and try again. One of the things they can change is a number in the block header provided for this purpose. That number is called the nonce.</p>
<p>If the miner finds a set of data that has a hash less than the target, they publish it. It takes a lot of tries before a set of data is found that has a low hash.</p>
<p>All nodes (wallets etc) check every part of the new block and either discard it or add it to their copy of the Blockchain.</p>
<p>One of the checks made by every node is to calculate the hash of the block to see if it is less than the network target. Nodes don't need to check all the miners failed arrangements of data, they only see the successful ones.</p>
<hr />
<p>See <a href="https://bitcoin.stackexchange.com/q/148/13866">What exactly is Mining?</a></p>

CC BY-SA 4.0
2022-08-03T20:32:28.570Z
When you say "One of the things they can change is a number in the block header provided for this purpose" do you mean all the miners or only a group of miners make this change?  I really appreciate your answers, thank you.
Ghost
CC BY-SA 4.0
2022-08-03T20:49:34.460Z
@Ghost. Outside mining pools, miners do not need to collaborate or share information. Conceptually at least, each miner acts in isolation. Each miner can create their own block template individually. Each miner can vary their template in whatever way they see fit. Each miner individually can do whatever they like with the nonce value.
RedGrittyBrick
CC BY-SA 4.0
2022-08-03T09:28:22.777Z
2022-08-03T10:28:41.783Z
2022-08-03T10:28:41.783Z
RedGrittyBrick
<p>When mining a block, who gets to choose the hash from the previous block, the nonce and its adjustment. Is it all the miners who choose or the ones who successfully found the block?</p>
<p>For either answer, how do they not know the correct answer to the nonce if they are the once who set it up?</p>

<mining-theory>
Who chooses the nonce and the hash from a previous block?
Ghost
# Who chooses the nonce and the hash from a previous block?

(Asked by: username_0 on 2022-08-03)

When mining a block, who gets to choose the hash from the previous block, the nonce and its adjustment. Is it all the miners who choose or the ones who successfully found the block?

For either answer, how do they not know the correct answer to the nonce if they are the once who set it up?

**Tags:** mining-theory


---

## 1 answers

### Answer by username_1 on 2022-08-03. Score: 2 | Accepted answer

## Previous block hash

> When mining a block, who gets to choose the hash from the previous block,

Nobody.

It isn't *chosen*. The current top block in the chain is known and its contents are fixed. The hash value depends only on the contents. Therefore the hash of the current top block is also a fixed value.

A good cryptographic hash algorithm, such as SHA256, produces a value that cannot be predicted from the data being hashed. Other than by doing all the work of actually computing the hash. Changing one bit in the data makes the hash result wildly different in a completely unpredictable way. The hashes look completely random.

---

## Nonce

> how do they not know the correct answer to the nonce if they are the once who set it up?

Nonces are not things that have an answer.

The nonce is just a numeric data item whose value has no meaning. It is provided for the miner's use as described below.

---

## Hashes & Nonces in Mining

Lets look at the role of block-hashes and nonces in mining:

A new block has a header that contains a reference to the previous block. When creating their block template a miner must set the previous block reference to the block-id (hash) of the current top block in the chain of blocks. This is necessary for their new block to become the next top block of the chain. Each block links to the previous block.

Then the miner computes a hash of their new block and if the resulting hash value is higher than the network target the arrangement of data is a failure and they must change something in their block template and try again. One of the things they can change is a number in the block header provided for this purpose. That number is called the nonce.

If the miner finds a set of data that has a hash less than the target, they publish it. It takes a lot of tries before a set of data is found that has a low hash.

All nodes (wallets etc) check every part of the new block and either discard it or add it to their copy of the Blockchain.

One of the checks made by every node is to calculate the hash of the block to see if it is less than the network target. Nodes don't need to check all the miners failed arrangements of data, they only see the successful ones.

---

See [What exactly is Mining?](https://bitcoin.stackexchange.com/q/148/13866)

> **Comments:**
> **username_0**: When you say "One of the things they can change is a number in the block header provided for this purpose" do you mean all the miners or only a group of miners make this change?  I really appreciate your answers, thank you.  
> **username_1**: @username_0. Outside mining pools, miners do not need to collaborate or share information. Conceptually at least, each miner acts in isolation. Each miner can create their own block template individually. Each miner can vary their template in whatever way they see fit. Each miner individually can do whatever they like with the nonce value.  

---

