<blockquote>
  <p>I understand a hash function is only one way function. You have an Input which produces a unique hash. This means that if multiple different parties are hashing the same input then their hash results must be identical, right?</p>
</blockquote>

<p>Multiple parties will never be hashing the same information. Either the parties are coordinating or they're not. If they're coordinating, they'll carefully avoid doing the same work because to do otherwise is foolish. If they're not coordinating, they can't possibly be doing the same work. I'm trying to find a hash that pays me money. If you're not coordinating with me, why would you also be doing that?</p>

<blockquote>
  <p>Given this definition, I really do not understand how the situation of orphan blocks in Bitcoin can happen? Because orphans happen for example when 2 miners at the same time solve the mining puzzle. But both are solving the exact same mining puzzle right? This means, they both have dealt with the same difficulty level of the puzzle and arrived at the same number of leading zeros for their hash, right?</p>
</blockquote>

<p>Probably. But they will produce different blocks since they're either trying to mine to different destination addresses or carefully coordinating to avoid duplication fo work.</p>

<blockquote>
  <p>How is the blockchain then distinguishing between those 2 miners, who has "put more work into the mining" if they have solved the same thing? On which parameters is the network looking to determine which of the two miners should get the reward?</p>
</blockquote>

<p>When the next block is found, whichever block the miner who found that block built on top of will be in a longer chain than the other, causing everyone to switch over to the longer chain. To get to keep your mining reward, the block you found must stay in the longest chain. To have the highest odds of this, you always try to mine to extend the chain that is already the longest. So any ties are quickly broken -- as soon as a block on top of one of the longest chains currently existing is found and no other block is found at around that same time, nearly everyone will be building on top of that block.</p>

CC BY-SA 4.0
2019-11-19T14:28:43.827Z
2019-11-19T14:28:43.827Z
David Schwartz
<p>Can someone please explain:</p>

<p>In Bitcoin proof of work, mining is done to create and validate new blocks. Who becomes the sole block producer is subject to winning a "mining puzzle".</p>

<p>As I understand, the difficulty is that the solution of this puzzle must have a specific number of leading zeros in the resulting hash.</p>

<p><strong>My questions are</strong>: </p>

<p><strong>1)</strong> must the hashing result have X number of leading zeros, or is the constraint more like "less or equal X number of leading zeros"? </p>

<p><strong>2)</strong> If the mining puzzle's solution has a hash as a result, what is then the input parameters for doing the hashing? What are the miners exactly hashing, what are all the input factors?  As i understand, input factors are e.g. the Nonce, previous Block's hash, etc...</p>

<p><strong>3)</strong> I understand a hash function is only one way function. You have an Input which produces a unique hash. This means that if multiple different parties are hashing the <strong>same input</strong> then their hash results must be identical, right?</p>

<p>Given this definition, I really do not understand how the situation of orphan blocks in Bitcoin can happen? Because orphans happen for example when 2 miners at the same time solve the mining puzzle. But both are solving the exact same mining puzzle right? This means, they both have dealt with the same difficulty level of the puzzle and arrived at the same number of leading zeros for their hash, right?  </p>

<p>How is the blockchain then distinguishing between those 2 miners, who has "put more work into the mining" if they have solved the same thing? On which parameters is the network looking to determine which of the two miners should get the reward?</p>

<p>Thanks</p>

<mining-theory><mining-reward><proof-of-work>
Bitcoin mining process-the leading zeros before the hash-how is the mining puzzle solved exactly?
johnsmiththelird
# Bitcoin mining process-the leading zeros before the hash-how is the mining puzzle solved exactly?

(Asked by: username_0 on 2019-11-19)

Can someone please explain:

In Bitcoin proof of work, mining is done to create and validate new blocks. Who becomes the sole block producer is subject to winning a "mining puzzle".

As I understand, the difficulty is that the solution of this puzzle must have a specific number of leading zeros in the resulting hash.

**My questions are**:

**1)** must the hashing result have X number of leading zeros, or is the constraint more like "less or equal X number of leading zeros"?

**2)** If the mining puzzle's solution has a hash as a result, what is then the input parameters for doing the hashing? What are the miners exactly hashing, what are all the input factors? As i understand, input factors are e.g. the Nonce, previous Block's hash, etc...

**3)** I understand a hash function is only one way function. You have an Input which produces a unique hash. This means that if multiple different parties are hashing the **same input** then their hash results must be identical, right?

Given this definition, I really do not understand how the situation of orphan blocks in Bitcoin can happen? Because orphans happen for example when 2 miners at the same time solve the mining puzzle. But both are solving the exact same mining puzzle right? This means, they both have dealt with the same difficulty level of the puzzle and arrived at the same number of leading zeros for their hash, right?

How is the blockchain then distinguishing between those 2 miners, who has "put more work into the mining" if they have solved the same thing? On which parameters is the network looking to determine which of the two miners should get the reward?

Thanks

**Tags:** mining-theory, mining-reward, proof-of-work


---

## 1 answers

### Answer by username_1 on 2019-11-19. Score: 1

> I understand a hash function is only one way function. You have an Input which produces a unique hash. This means that if multiple different parties are hashing the same input then their hash results must be identical, right?

Multiple parties will never be hashing the same information. Either the parties are coordinating or they're not. If they're coordinating, they'll carefully avoid doing the same work because to do otherwise is foolish. If they're not coordinating, they can't possibly be doing the same work. I'm trying to find a hash that pays me money. If you're not coordinating with me, why would you also be doing that?

> Given this definition, I really do not understand how the situation of orphan blocks in Bitcoin can happen? Because orphans happen for example when 2 miners at the same time solve the mining puzzle. But both are solving the exact same mining puzzle right? This means, they both have dealt with the same difficulty level of the puzzle and arrived at the same number of leading zeros for their hash, right?

Probably. But they will produce different blocks since they're either trying to mine to different destination addresses or carefully coordinating to avoid duplication fo work.

> How is the blockchain then distinguishing between those 2 miners, who has "put more work into the mining" if they have solved the same thing? On which parameters is the network looking to determine which of the two miners should get the reward?

When the next block is found, whichever block the miner who found that block built on top of will be in a longer chain than the other, causing everyone to switch over to the longer chain. To get to keep your mining reward, the block you found must stay in the longest chain. To have the highest odds of this, you always try to mine to extend the chain that is already the longest. So any ties are quickly broken -- as soon as a block on top of one of the longest chains currently existing is found and no other block is found at around that same time, nearly everyone will be building on top of that block.


---

