Whenever new miners join the network, the proof of work difficulty increases automatically. The difficulty represents the number of zeros that the code (hash) needs to have. The bigger the number of zeros at the beginning, the harder it is for miners to find the solution.
To find the solution that joins the current block to the previous one, miners have to follow the process below, basically a trial and error until they find a working hash.
Thus, to mine a block, you need to meet certain conditions. Some small variations may apply depending on the algorithm used, but it usually requires a hash to start with several zeros.
The process is quite simple yet very repetitive: miners repeat it billions and billions of times every 10 minutes.
To perform the necessary Proof of Work to mine the block and get the 6.25 Bitcoin payout, the miner needs to post a valid hash following these steps:
- Create the block header and convert it into a string of data.
- Adds a nonce (variable data) to feed a hashing algorithm.
- Get the resulting hash and check to see if it meets the difficulty.
- If the condition is met, the miner has found the nonce that generates a valid hash for that specific block.
- If the condition was not met (most likely), the miner will try a different nonce, back to point 2. He will repeat the process until it produces a valid hash or propagates a new block in the network.
Once a miner finds the valid hash, he will broadcast the new block to the network. Every Bitcoin software user (node) and miners can easily verify that the proposed hash works and meets the target difficulty.
In return, the miner that created the block will receive 6.25 newly minted Bitcoins.
Computation or Pure Luck?
Miners try to find hash values that start with many zeros, increasing the network’s difficulty. For example, if you think about the probability of finding a hash starting with 20 straight zeros, it becomes exponentially more challenging.
It’s similar to winning a lottery ticket among quadrillions of numbers available. Roughly equivalent to tossing dices and getting the same number 15 times in a row. You can imagine that it’s a very low probability, and that’s why it is so hard to mine Bitcoin.
To illustrate the probabilities and how difficult it is to get a valid hash with an enormous number of zeros, let’s imagine that we are playing with dice. What’s the odds of tossing 15 dices and getting the same value for every single one?
1 dice: (1/6)¹ = 0.16 or 16% probability
2 dices: (1/6)² = 0.0277 or 2.77% probability
4 dices: (1/6)⁴ = 0.0007716 or 0.07716% probability
6 dices: (1/6)⁶ = 0.00002143 or 0.002143% probability
15 dices: (1/6)¹⁵ = 0.000000000002127 or 0.0000000002127%
This is equivalent to tossing the dice 470 billion times to get one straight 15 sequences of the same consecutive number.
The mining difficulty is adjusted every 2016 blocks, which is roughly two weeks considering the 10 minutes average interval per block.
Imagine trying to mine a Bitcoin block by yourself and using the best CPU in the market, the AMD Ryzen 9 5900X. It would take you 200,000 years to mine one single Bitcoin block at the current difficulty.
In 2020, miners received some $7 billion worth of Bitcoin block rewards, plus another $800 million in fees paid by the users. It seems like a decent payout for this lucky guessing work!