Difficulty (Cryptocurrencies)

What is 'Difficulty (Cryptocurrencies)'

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.

BREAKING DOWN 'Difficulty (Cryptocurrencies)'

Bitcoin and other cryptocurrencies that use proof-of-work blockchains are maintained through a process called mining. In this system, miners – computers running the cryptocurrency's software client – compete to find a new block, adding the most recent batch of transaction data to the chain. They receive fees and a (in some cases) a reward of new tokens in return. (See also, Merkle Tree.)

The time it takes to find a new block is subject to two factors: random chance and difficulty. Start with random chance. 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. There is no way of predicting what a hash will be. A new block is found when the hash meets a certain requirement. Since each set of data has only one output for a given hash function, miners must add a nonce – a "number used once" – to the data to obtain a new hash. If the result still does not meet the requirement, the miner tries again with a new nonce.

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: over time, however, higher difficulty means that miners must plug through more nonces per block on average. (See also, How Does Bitcoin Mining Work?)

What Purpose Does Difficulty Serve?

Why set higher difficulty, if the only practical result is that miners must repeat the same function more? The bitcoin whitepaper explains:

"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 1.

To check bitcoin difficulty in real time, you can consult this chart.

As of late January 2018, it is 2,603,077,300,218.593. The chart below shows bitcoin's change in difficulty over time: