What Is Cryptocurrency Difficulty?
Cryptocurrency difficulty is a measure of how difficult it is to mine a block in a blockchain for a particular cryptocurrency. A high cryptocurrency difficulty means it takes additional computing power to verify transactions entered on a blockchain—a process called mining.
Cryptocurrency difficulty is a parameter that bitcoin and other cryptocurrencies use to keep the average time between blocks steady as the network's hash power changes. Cryptocurrency difficulty is important since a high difficulty can help secure the blockchain network against malicious attacks.
- Cryptocurrency difficulty is a measure of how difficult it is to mine a block in a blockchain for a particular cryptocurrency.
- A high cryptocurrency difficulty means it takes additional computing power to verify transactions entered on a blockchain.
- The higher the difficulty needed to create a block improves a cryptocurrency network's security since attackers would need enormous resources to take control.
Understanding Cryptocurrency Difficulty
Bitcoin and other cryptocurrencies that use proof-of-work blockchains are maintained through the process of mining. Miners verify transactions that are done on a blockchain and perform the duties of auditors to prevent fraud and ensure the legitimacy of the transactions. Mining was conceived by bitcoin's founder, Satoshi Nakamoto.
In this system, miners—who run the cryptocurrency's software on their computers—compete to find a new block, adding the most recent batch of transaction data to the chain. When enough transactions have been verified, a new block is added to the blockchain. Miners may get paid a fee for their efforts but there are other requirements before a miner can receive compensation if any at all. The extent of the computing power needed to mine a block is represented by cryptocurrency difficulty. The time it takes to find a new block is subject to the level of cryptocurrency difficulty and random chance.
In order to measure the cryptocurrency difficulty of a new block, it's important to understand hash power, which represents the combined computational power being used to mine and process the transactions on the blockchain.
A hash is an alphanumeric code that's used to represent words or data. Miners take a batch of transaction data and run it through a hash algorithm, a one-way function that—given a particular set of data—will always produce the same output, but whose output cannot be reversed to show the original data. Hashing algorithms are used to create these random hash codes. Before new data can be added to a blockchain, miners must compete to produce a hash that's lower or equal to a numeric value called a target hash.
Miners accomplish the hashing process by changing a single value, called a nonce—or a number used once—and each time the nonce is changed, a new hash is created with its own set of numbers. There is no way of predicting what a hash will be and since each set of data has only one output for a given hash function, miners must repeat the process of adding a new nonce to the data until they meet the hash requirement.
The requirement a hash must meet corresponds to the difficulty. A valid hash must be below a certain target value set automatically (and periodically adjusted) by the cryptocurrency's protocol. The lower the target value, the more repetitions of the hash function a miner must go through in order to get an acceptable result—in other words, the higher the difficulty. A miner can, in theory, get lucky and obtain a valid hash for a given block on the first try. However, over time, higher difficulty means that miners must plug through more nonces per block on average.
Individuals and organizations contribute their computational power via their mining rigs to process the data and produce the hashes. The hash power of a cryptocurrency network represents the total hash rates of all the mining rigs. The hash rate is the number of hashes that can be calculated per second.
Since each hash is created randomly, it can take millions of guesses or hashes before the target hash requirement is met and new cryptocurrency coins are minted to the successful miner. Only then are the transactions added to a new block within the blockchain. In a way, the hashing process is similar to a lottery system. As a result, new coins are issued through this mining process.
The higher the hash rate, the more difficult it is for a fraudster to gain control of the blockchain since more hashing power is needed. In other words, the higher the difficulty, the more secure the network.
Benefits of Cryptocurrency Difficulty
One might wonder why a network's participants would establish a higher cryptocurrency difficulty if the result meant miners repeating the same function over and over. There are two key benefits to cryptocurrency difficulty.
A Steady Rate of New Blocks
The bitcoin whitepaper by Satoshi Nakamoto explains how the proof-of-work difficulty helps to generate a steady production of new blocks added to the blockchain.
"To compensate for increasing hardware speed and varying interest in running nodes over time, the proof-of-work difficulty is determined by a moving average targeting an average number of blocks per hour. If they're generated too fast, the difficulty increases."
Bitcoin is designed to add a new block to the blockchain every 10 minutes on average. Other cryptocurrencies aim for more frequent blocks; litecoin, for example, aims for 2.5 minutes. The issue is that the amount of computing power the network's miners collectively control can vary enormously.
When Satoshi Nakamoto mined the first block, there was only one machine on the network—likely a simple laptop or desktop. Today there are a number of sprawling, warehouse-sized ASIC farms. ASICs are machines designed specifically to plow through hash functions as fast as possible.
In order to ensure that the network produces a new block at a steady average rate, the software is set to automatically adjust the target hash up or down, which results in lower or higher difficulty, respectively. When Nakamoto mined the genesis block, bitcoin's difficulty was one.
The overall hash rate provides insight into a cryptocurrency network's security since fraudsters or bad actors would need to overcome the total hash power of the network to take control in a malicious attack. Specially designed computers are used to perform hashing functions, which are able to make trillions of guesses each second to solve the hashing problem.
The higher the cryptocurrency difficulty, the more guesses or hashes are needed to reach the target hash requirement. As a result, this process makes it very difficult and expensive for attackers to gain the majority control—called a 51% majority—of a blockchain network.
Example of Cryptocurrency Difficulty
As of April 2, 2021, the cryptocurrency difficulty for bitcoin was 23.14 trillion. If we compare the change in difficulty, we can see that on April 1, 2018, bitcoin's difficulty was 3.51 trillion.
The chart below plots bitcoin's change in difficulty over the years: