fbpx

Crypto in an Hour: Part 11 – Difficulty Target

by | Dec 10, 2019

We’ve talked about how to encrypt the information of all the transactions through the Merkel Tree, and the subsequent hash is almost ready to be added to the blockchain. Before that can be done, the miner needs to hash the entire block to produce the block’s name. The name can’t be just anything but has to fit specific parameters dictated by the difficulty target.

Bitcoin code dictates that a new block should be added to the blockchain about every ten minutes. For that target time to be hit, the miners are given a cryptographic puzzle, or certain parameters the output must meet, and finding that output is intended to take about ten minutes to solve. The cryptographic puzzle is basically guessing the name of the block. The amount of time it takes for a miner to guess the name can fluctuate depending on the overall number of miners and the computing power of their equipment, so the difficulty of the puzzle needs to be adaptive. The adaptiveness of the difficulty is part of Bitcoin’s code.

Every time 2016 blocks are added to the blockchain, the Bitcoin code analyzes the amount of time it took for the puzzle to be solved. The puzzle’s difficulty is then fine-tuned, either harder or easier. The target is to come as close as possible to ten minutes between every block during the following two weeks.

When all six pieces of the block are hashed together, the resulting 256-bit output, or name, starts with a either a number or a letter. There is a possibility that the name starts with a zero. The probability of finding a name that starts with two zeros is even smaller. The difficulty target is modified by increasing or decreasing the number of zeros required at the beginning of the name. If the previous two-week average had been too quick, the difficulty target would be changed to include more zeros at the beginning of the name. Conversely, if the average was too slow, fewer leading zeros would make guessing the name easier. The average time it took for a block to be added during the first half of 2019 ranged from as low as 9.3 minutes in January to as high as 12.3 minutes in May.

Hitting the ten-minute mark maintains one of Bitcoin’s core characteristics. It guarantees that new bitcoins are added at a set rate, making bitcoin anti-inflationary.

Now that you know about how the difficulty target works, there’s only one more piece of the block to learn about. The next lesson is all about the nonce.

X