<p>Mining basically works like this:</p>

<ol>
<li>Make a candidate block, try all nonces.</li>
<li>If none yielded a valid block, change something in the coinbase transaction.</li>
<li>Repeat from step 1.</li>
</ol>

<p>Miners collect transactions and then try to create a valid block by bruteforcing nonces. The difficulty of creating a block is related to the maximum hash value a valid block may have.</p>

<p>For example the current blockchain head (while posting this) has a block hash of 00000000000000000077d9c18fdbd5cf45b2652fe6db9089558eb8fc9fc3b397.
As you can see it has many leading zeros, because most hashes above this value are rejected. With the 2^32 nonce values and other header fields you cannot try enough blocks to be likely to hit any block hash small enough. Miners will switch some bytes in transactions (normally in the coinbase) to create even more new block candidates.</p>

<p>Furthermore different miners will try different blocks, as they should have different receivers of the coinbase transactions.</p>

CC BY-SA 3.0
2017-09-04T15:13:45.283Z
So the current difficulty is so high that even if a miner computes the hashes for all possible 2^32 nonces, it is still unlikely to find one below the current target. Thus, it needs to keep trying with a different coinbase until one of the 2^32 nounces actually works. Could you please point me to some documentation explaining all about coinbase transactions and new block candidates? I think that's what's missing in my puzzle.
Edward Eisenberg
CC BY-SA 3.0
2017-09-04T20:29:26.757Z
@EdwardEisenberg: Basically, miners are free to choose which transactions, or even if any at all, they would like to include in a mined block. Run through all the nonces? No problem, just add or remove a transaction and you've immediately got another few trillion hashes to try.
Greg Hewgill
CC BY-SA 3.0
2017-09-05T10:28:27.587Z
It is not necessary to remove or add transactions. There are some malicious miners which even mine empty blocks (apart from the coinbase), so have nothing to change in that regard. The coinbase transaction can contain arbitrary data and just putting some additional nonce bytes in there is sufficient.
Leonidaz0r
CC BY-SA 3.0
2017-09-05T10:30:59.607Z
@EdwardEisenberg https://en.bitcoin.it/wiki/Transaction#Generation
Leonidaz0r
CC BY-SA 3.0
2017-09-04T15:07:47.133Z
2017-09-04T15:07:47.133Z
Leonidaz0r
<p>That happens because it becomes increasingly hard to mine as more hashpower is deployed to the network.</p>
<p>Every 2016 blocks (2 weeks) the required difficulty (leading zeroes in the block hash) for a block to be accepted as valid increases (or decreases) according to how fast the past 2016 blocks were mined. This is done by comparing the timestamp declared in the block with the timestamp that would be expected if 10 minute blocks were assumed.</p>

CC BY-SA 4.0
2023-09-16T12:16:17.013Z
2023-09-16T12:16:17.013Z
fiatjaf
<p>No matter how high the difficuly is (or how low the target is), I don't understand how the Bitcoin network takes an average of 10 minutes to solve each block.</p>

<p>For any given block header, there are only 2^32 possible values for the nonce. Even if we take into account that the timestamp can be changed by up to 1 hour (for example), that's 3600 x 2^32 possible combinations, which is approximately 1.5e13</p>

<p>On blockchain.info it says the current hash rate of the network is 7,991,378,504 GH/s, which means that, every second, there are multiple orders of magnitude more hashes being calculated than the number of possible hashes that can result from the current block header.</p>

<p><strong>So howcome blocks aren't solved in only a few seconds, and take about 10 minutes instead?</strong></p>

<p>I understand that miners want to include as many transactions as they can in a block to collect the fees, so one could argue it's best to wait until there are many transaction in a block before solving it. But even that doesn't make sense, because there's absolutely nothing to lose in solving each block as fast as possible anyway.</p>

<block><network><hash><difficulty>
With the current hashrate, how does it still take 10min to solve a bitcoin block?
Edward Eisenberg
# With the current hashrate, how does it still take 10min to solve a bitcoin block?

(Asked by: username_0 on 2017-09-04)

No matter how high the difficuly is (or how low the target is), I don't understand how the Bitcoin network takes an average of 10 minutes to solve each block.

For any given block header, there are only 2^32 possible values for the nonce. Even if we take into account that the timestamp can be changed by up to 1 hour (for example), that's 3600 x 2^32 possible combinations, which is approximately 1.5e13

On blockchain.info it says the current hash rate of the network is 7,991,378,504 GH/s, which means that, every second, there are multiple orders of magnitude more hashes being calculated than the number of possible hashes that can result from the current block header.

**So howcome blocks aren't solved in only a few seconds, and take about 10 minutes instead?**

I understand that miners want to include as many transactions as they can in a block to collect the fees, so one could argue it's best to wait until there are many transaction in a block before solving it. But even that doesn't make sense, because there's absolutely nothing to lose in solving each block as fast as possible anyway.

**Tags:** block, network, hash, difficulty


---

## 2 answers

### Answer by username_1 on 2017-09-04. Score: 1 | Accepted answer

Mining basically works like this:

1. Make a candidate block, try all nonces.
2. If none yielded a valid block, change something in the coinbase transaction.
3. Repeat from step 1.

Miners collect transactions and then try to create a valid block by bruteforcing nonces. The difficulty of creating a block is related to the maximum hash value a valid block may have.

For example the current blockchain head (while posting this) has a block hash of 00000000000000000077d9c18fdbd5cf45b2652fe6db9089558eb8fc9fc3b397.
As you can see it has many leading zeros, because most hashes above this value are rejected. With the 2^32 nonce values and other header fields you cannot try enough blocks to be likely to hit any block hash small enough. Miners will switch some bytes in transactions (normally in the coinbase) to create even more new block candidates.

Furthermore different miners will try different blocks, as they should have different receivers of the coinbase transactions.

> **Comments:**
> **username_0**: So the current difficulty is so high that even if a miner computes the hashes for all possible 2^32 nonces, it is still unlikely to find one below the current target. Thus, it needs to keep trying with a different coinbase until one of the 2^32 nounces actually works. Could you please point me to some documentation explaining all about coinbase transactions and new block candidates? I think that's what's missing in my puzzle.  
> **username_2**: @EdwardEisenberg: Basically, miners are free to choose which transactions, or even if any at all, they would like to include in a mined block. Run through all the nonces? No problem, just add or remove a transaction and you've immediately got another few trillion hashes to try.  
> **username_1**: It is not necessary to remove or add transactions. There are some malicious miners which even mine empty blocks (apart from the coinbase), so have nothing to change in that regard. The coinbase transaction can contain arbitrary data and just putting some additional nonce bytes in there is sufficient.  
> **username_1**: @EdwardEisenberg https://en.bitcoin.it/wiki/Transaction#Generation  

---

### Answer by username_3 on 2023-09-16. Score: 0

That happens because it becomes increasingly hard to mine as more hashpower is deployed to the network.

Every 2016 blocks (2 weeks) the required difficulty (leading zeroes in the block hash) for a block to be accepted as valid increases (or decreases) according to how fast the past 2016 blocks were mined. This is done by comparing the timestamp declared in the block with the timestamp that would be expected if 10 minute blocks were assumed.


---

