This is one article in a collection of 52 articles published weekly throughout 2023 on the basics of Bitcoin. The series is intended for people unfamiliar with Bitcoin or people wishing to enhance their understanding of the fundamentals that underpin the technology. Please contact us, if you have any questions or comments.
A new block is mined when a miner inputs a piece of data (known as a block header which will be discussed more thoroughly in a future publication) that has a hash value, the output expressed as a hexadecimal number once the piece of data has been placed through the hash function, that is lesser than or equal to the target hash. The more leading zeros that are required to produce a number from the hash value that is less than the target hash, the more computation power the miners will need to expend to mine a block (at least on average). In other words, the more leading zeros that are required to get below the target hash, the harder it is for miners to mine a block. The Bitcoin network sets a target hash.
While understanding the bitcoin mining process can be overwhelming, it is important to understand because it highlights the security of the Bitcoin protocol. As a result of the Bitcoin hash function randomly generating numbers, the chances of one leading zero can be thought of as a 1 in 16 chance or a 6.25 percent chance. The chances of the first two hexadecimal numbers being a leading zero would be 0.39 percent (0.0625 * 0.0625 = 0.0039). With each hexadecimal number having a 1/16 chance of being zero, this calculation can be performed using the number of zeros required to generate the target hash value. The lowest number of leading zeros ever required to mine a bitcoin was 8 leading zeros. The odds of generating a hash value with eight leading zeros is 0.00000002 percent. As mentioned above, the current difficulty level for bitcoin miners requires 19 or more leading zeros in the hexadecimal hash value. The odds of generating a hash value with 19 leading zeros is 0.000000000000000000001 percent (that is 1 preceded by 20 zeros). The computing power that secures the Bitcoin network is hard to fathom. As a result of the computing power, the Bitcoin network has never been hacked and it has created the most secure computing system that has ever existed.
One of the key features of the Bitcoin protocol was Satoshi’s foresight of adjusting the difficulty for a miner to be able to mine the next block, commonly referred to as a difficulty adjustment. Every 2016 blocks (which approximately equates to every two weeks) a difficulty adjustment occurs to reflect the number of miners trying to generate new blocks and the technological improvements miners are continually making. If more miners are participating or the equipment being used by miners is generating more attempts to guess the hash value, the difficulty adjustment will produce a lower target hash. However, if fewer miners are participating and the miners are generating fewer attempts to guess the hash value, the difficulty adjustment will produce a higher target hash. The goal of the difficulty adjustment is to have the new blocks generated approximately every 10 minutes.
At the time of this publication, the target hash requires 19 leading zeros for a miner to win the right to mine the block! However, if a miner discovers a hash with more than 19 leading zeros, the miner will still win the right to mine the block. Interestingly, the block that was mined with the most leading zeros to date was Bitcoin block 634,842 which had an astounding 23 leading zeros. It is the only block to ever have 23 or more leading zeros! As of January 30, 2023, Bitcoin’s hash rate is 269,950,000 terahashes per second (TH/s). In other words, currently miners are inputting 269,950,000,000,000,000,000 nonces (or guesses for a layman) per second to attempt to mine the next Bitcoin block!