<blockquote>
<p>Question 1. How does software like NiceHash miner or other mining tools handle situations like this under the hood?</p>
</blockquote>
<p>There's literally nothing to do in this case. If you don't find a nonce that works, then you have to try a new block.</p>
<blockquote>
<p>Here is another issue, it is going to take computers some time to try out every nonce value because there are 4 billion of them. Question 2: Is there a time limit to how long a miner can take to guess and check before the given work is no longer &quot;accepted&quot;?</p>
</blockquote>
<p>Realistic miners take a very tiny fraction of a second to try every possible nonce. It's so fast that working on a single block at a time is completely unrealistic and real miners will try several possible blocks at a time.</p>
<p>Typical mining pools will accept a share so long as it is turned into the pool before a new block is mined. That means that on average you have a ten minute window. A share turned in after a block is mined is called a &quot;stale share&quot;. Under realistic conditions, they should be rare. Every ten minutes, right after a block is found, there's a window of a second or two in which a stale share might be turned in even if nothing goes wrong.</p>
<blockquote>
<p>Question 3: How much, usually, is each share reward is in US dollars? I am guessing it varies from pool to pool, but what would the financial value usually be at?</p>
</blockquote>
<p>A difficulty one share is essentially worthless. It takes only 4 billion hashes or so to generate a difficulty one share and realistic miners would generate so many of these that there is no way they could keep up and have to use <em>much</em> lower targets to generate a realistic number of shares. A single Bitmain S19 Pro miner produces 110 trillion hashes per second -- that's thousands of difficulty one shares per second.</p>
<p>The bitcoin network is currently getting around 100 quintillion hashes per second. Total mining revenue is about $56 million per day. That makes the value of 4 billion hashes approximately 0.0000025 cents.</p>

CC BY-SA 4.0
2021-08-16T17:28:35.363Z
2021-08-16T20:26:05.260Z
2021-08-16T20:26:05.260Z
David Schwartz
<p>Most people mine bitcoin by launching a software on their PC or buying a special miner, both of which abstract out the nitty-gritty of how the mining process work. I am curious however about some potential issues with the nitty-gritty of the mining process. Feel free to skip to my question if you already know how it works:</p>
<p>As far as I know, this is how it works:</p>
<p>Given a string of hex values that is 1024 bit (or 256 hex values, or 128 bytes), let's say</p>
<pre><code>0x000000020597ba1f0cd423b2a3abb0259a54ee5f783077a4ad45fb6200000218000000008348d1339e6797e2b15e9a3f2fb7da08768e99f02727e4227e02903e43a42b31511553101a051f3c00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000
</code></pre>
<p>And a 256 bit (or 64 hex values, or 32 bytes) value known as the target</p>
<pre><code>0x00000000FFFF0000000000000000000000000000000000000000000000000000
</code></pre>
<p>We first byteswap each 32-bit chunk, so we end up with</p>
<pre><code>0x020000001fba9705b223d40c25b0aba35fee549aa477307862fb45ad180200000000000033d14883e297679e3f9a5eb108dab72ff0998e7622e427273e90027e312ba443105315513c1f051a00000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000280
</code></pre>
<p>We read the last 64 bits (or 16 hex values or 8 bytes)</p>
<pre><code>0x0000000000000280
</code></pre>
<p>Which equals to 640 bits, or 80 bytes.</p>
<p>So we grab the first 640 bits (or 160 hex values, or 80 bytes) of byte-swapped string of hex
values</p>
<pre><code>0x020000001fba9705b223d40c25b0aba35fee549aa477307862fb45ad180200000000000033d14883e297679e3f9a5eb108dab72ff0998e7622e427273e90027e312ba443105315513c1f051a00000000
</code></pre>
<p>We do not change the first 608 bits, but we keep on changing the last 32 bits (or also known as the nonce value) and put the new string of hex values into the SHA256 function</p>
<pre><code>#scroll to right to see the last 8 bits incrementing
    new_hash = SHA256('0x020000001fba9705b223d40c25b0aba35fee549aa477307862fb45ad180200000000000033d14883e297679e3f9a5eb108dab72ff0998e7622e427273e90027e312ba443105315513c1f051a00000000')
    
    new_hash = SHA256('0x020000001fba9705b223d40c25b0aba35fee549aa477307862fb45ad180200000000000033d14883e297679e3f9a5eb108dab72ff0998e7622e427273e90027e312ba443105315513c1f051a00000001')
    
    new_hash = SHA256('0x020000001fba9705b223d40c25b0aba35fee549aa477307862fb45ad180200000000000033d14883e297679e3f9a5eb108dab72ff0998e7622e427273e90027e312ba443105315513c1f051a00000002')
    
#    .. so on
</code></pre>
<p>If we find a new_hash that is lower or equal to the target,</p>
<pre><code># one of the new_hash is 
new_hash = 0x00000000fffe0000000000000000000000000000000000000000000000000000
# which is is lower than target
</code></pre>
<p>then we have successfully found a nonce value (the 32 bits that we are changing) that satisfies the requirement, so we can submit it and earn a share, which I understand is a small chunk of reward to the miner when the actual full requirements are satisfied.</p>
<p><em>Where I read this: <a href="https://en.bitcoin.it/wiki/Getwork" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Getwork</a></em></p>
<p><em><strong>Skip down to here if you already know how bitcoin mining works under the hood.</strong></em>
When I learn about this, however, I have 3 questions about it:</p>
<p>To be able to get a value lower than that target randomly, there will be a 1 in 4295032833 (4.3 billion) chance of succeeding.</p>
<p>The nonce value which we can change is 32 bit or 4294967296.</p>
<p>So the expected value of getting it right after trying every nonce value is (4294967296/4295032833), or basically 1.</p>
<p>But that is the expected value, there will be cases where every nonce value is tried and we still do not get to the target.</p>
<p><em><strong>Question 1</strong></em>. How does software like NiceHash miner or other mining tools handle situations like this under the hood?</p>
<p>Here is another issue, it is going to take computers some time to try out every nonce value because there are 4 billion of them.
<em><strong>Question 2</strong></em>: Is there a time limit to how long a miner can take to guess and check before the given work is no longer &quot;accepted&quot;?</p>
<p>And here is my 3rd one, the given target is not exactly sufficient in mining a full block, attaining it will instead earn miners a share. The system is implemented like this so that miners can share their reward proportional to the amount of computation they have performed.</p>
<p><em><strong>Question 3</strong></em>: How much, usually, is each share reward is in US dollars? I am guessing it varies from pool to pool, but what would the financial value usually be at?</p>
<p>Also if there is something wrong with my own re-articulation of how bitcoin mining works, please let me know as well.</p>

CC BY-SA 4.0
2021-08-16T16:25:38.360Z
Not a real answer, but just FYI, NiceHash does not mine BTC. It mines various altcoins (which can be mined without specialized hardware; the process is different for each) for the pool, credits your account for it after converting to BTC, and then lets you withdraw the BTC. Bitcoin itself cannot realistically be mined with generic-purpose hardware since 2013 or so. It's all specialized ASICs now.
Pieter Wuille
<mining-pools><mining-theory><mining-reward>
Some questions about specifics on bitcoin mining
Enthusiast
# Some questions about specifics on bitcoin mining

(Asked by: username_0 on 2021-08-16)

Most people mine bitcoin by launching a software on their PC or buying a special miner, both of which abstract out the nitty-gritty of how the mining process work. I am curious however about some potential issues with the nitty-gritty of the mining process. Feel free to skip to my question if you already know how it works:

As far as I know, this is how it works:

Given a string of hex values that is 1024 bit (or 256 hex values, or 128 bytes), let's say

```
0x000000020597ba1f0cd423b2a3abb0259a54ee5f783077a4ad45fb6200000218000000008348d1339e6797e2b15e9a3f2fb7da08768e99f02727e4227e02903e43a42b31511553101a051f3c00000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000

```

And a 256 bit (or 64 hex values, or 32 bytes) value known as the target

```
0x00000000FFFF0000000000000000000000000000000000000000000000000000

```

We first byteswap each 32-bit chunk, so we end up with

```
0x020000001fba9705b223d40c25b0aba35fee549aa477307862fb45ad180200000000000033d14883e297679e3f9a5eb108dab72ff0998e7622e427273e90027e312ba443105315513c1f051a00000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000280

```

We read the last 64 bits (or 16 hex values or 8 bytes)

```
0x0000000000000280

```

Which equals to 640 bits, or 80 bytes.

So we grab the first 640 bits (or 160 hex values, or 80 bytes) of byte-swapped string of hex
values

```
0x020000001fba9705b223d40c25b0aba35fee549aa477307862fb45ad180200000000000033d14883e297679e3f9a5eb108dab72ff0998e7622e427273e90027e312ba443105315513c1f051a00000000

```

We do not change the first 608 bits, but we keep on changing the last 32 bits (or also known as the nonce value) and put the new string of hex values into the SHA256 function

```
#scroll to right to see the last 8 bits incrementing
    new_hash = SHA256('0x020000001fba9705b223d40c25b0aba35fee549aa477307862fb45ad180200000000000033d14883e297679e3f9a5eb108dab72ff0998e7622e427273e90027e312ba443105315513c1f051a00000000')
    
    new_hash = SHA256('0x020000001fba9705b223d40c25b0aba35fee549aa477307862fb45ad180200000000000033d14883e297679e3f9a5eb108dab72ff0998e7622e427273e90027e312ba443105315513c1f051a00000001')
    
    new_hash = SHA256('0x020000001fba9705b223d40c25b0aba35fee549aa477307862fb45ad180200000000000033d14883e297679e3f9a5eb108dab72ff0998e7622e427273e90027e312ba443105315513c1f051a00000002')
    
#    .. so on

```

If we find a new\_hash that is lower or equal to the target,

```
# one of the new_hash is 
new_hash = 0x00000000fffe0000000000000000000000000000000000000000000000000000
# which is is lower than target

```

then we have successfully found a nonce value (the 32 bits that we are changing) that satisfies the requirement, so we can submit it and earn a share, which I understand is a small chunk of reward to the miner when the actual full requirements are satisfied.

*Where I read this: <https://en.bitcoin.it/wiki/Getwork>*

***Skip down to here if you already know how bitcoin mining works under the hood.***
When I learn about this, however, I have 3 questions about it:

To be able to get a value lower than that target randomly, there will be a 1 in 4295032833 (4.3 billion) chance of succeeding.

The nonce value which we can change is 32 bit or 4294967296.

So the expected value of getting it right after trying every nonce value is (4294967296/4295032833), or basically 1.

But that is the expected value, there will be cases where every nonce value is tried and we still do not get to the target.

***Question 1***. How does software like NiceHash miner or other mining tools handle situations like this under the hood?

Here is another issue, it is going to take computers some time to try out every nonce value because there are 4 billion of them.
***Question 2***: Is there a time limit to how long a miner can take to guess and check before the given work is no longer "accepted"?

And here is my 3rd one, the given target is not exactly sufficient in mining a full block, attaining it will instead earn miners a share. The system is implemented like this so that miners can share their reward proportional to the amount of computation they have performed.

***Question 3***: How much, usually, is each share reward is in US dollars? I am guessing it varies from pool to pool, but what would the financial value usually be at?

Also if there is something wrong with my own re-articulation of how bitcoin mining works, please let me know as well.

**Tags:** mining-pools, mining-theory, mining-reward

> **Comments:**
> **username_1**: Not a real answer, but just FYI, NiceHash does not mine BTC. It mines various altcoins (which can be mined without specialized hardware; the process is different for each) for the pool, credits your account for it after converting to BTC, and then lets you withdraw the BTC. Bitcoin itself cannot realistically be mined with generic-purpose hardware since 2013 or so. It's all specialized ASICs now.  

---

## 1 answers

### Answer by username_2 on 2021-08-16. Score: 2

> Question 1. How does software like NiceHash miner or other mining tools handle situations like this under the hood?

There's literally nothing to do in this case. If you don't find a nonce that works, then you have to try a new block.

> Here is another issue, it is going to take computers some time to try out every nonce value because there are 4 billion of them. Question 2: Is there a time limit to how long a miner can take to guess and check before the given work is no longer "accepted"?

Realistic miners take a very tiny fraction of a second to try every possible nonce. It's so fast that working on a single block at a time is completely unrealistic and real miners will try several possible blocks at a time.

Typical mining pools will accept a share so long as it is turned into the pool before a new block is mined. That means that on average you have a ten minute window. A share turned in after a block is mined is called a "stale share". Under realistic conditions, they should be rare. Every ten minutes, right after a block is found, there's a window of a second or two in which a stale share might be turned in even if nothing goes wrong.

> Question 3: How much, usually, is each share reward is in US dollars? I am guessing it varies from pool to pool, but what would the financial value usually be at?

A difficulty one share is essentially worthless. It takes only 4 billion hashes or so to generate a difficulty one share and realistic miners would generate so many of these that there is no way they could keep up and have to use *much* lower targets to generate a realistic number of shares. A single Bitmain S19 Pro miner produces 110 trillion hashes per second -- that's thousands of difficulty one shares per second.

The bitcoin network is currently getting around 100 quintillion hashes per second. Total mining revenue is about $56 million per day. That makes the value of 4 billion hashes approximately 0.0000025 cents.


---

