Difficulty is a term used in bitcoin mining that refers to how difficult it is to find a hash below a certain value or a hash with a certain number of zeros in front of it. Hashes are displayed in what is known as ‘hexidecimal’ notation or a bunch of numbers and letters. They look something like this:
Even though there are a bunch of letters, this hexadecimal notation corresponds to a number. This hash or hexadecimal is what is attached to a block to identify it as a legitimate block in the chain and is deemed legitimate due to the work put in to find it. To find this hash, miners must combine the hash of the previous block with hash of the transactions of the block they are trying to add and a “nonce” or random variable that will eventually give the desired hash.
Finding this hash requires that a computer guessed random numbers (the nonce) billions upon billions of times per second until it found this specific hash. Difficulty adjustments occur every 2016 blocks and ensure that it takes 10 minutes on average to mine a block or find a particular hash such as the one above. Increasing the number of zeros in front of the target hash increases the difficulty exponentially and vice versa. Whoever finds the nonce and corresponding target hash with a particular number of zeros, gets rewarded in bitcoin.
Therefore, bitcoin mining difficulty is very important because it controls the rate at which units are created as well as protects the network from DDoS attacks due to the work required. Difficulty also introduces competition in that those with more powerful mining hardware will be able to guess more nonce’s and thus be more profitable. If it were not for this difficulty, anyone could mine bitcoin at any rate and there would be no competition.
A Quick Explanation of Bitcoin Mining Difficulty was originally published in Data Driven Investor on Medium, where people are continuing the conversation by highlighting and responding to this story.