*See also: target*

## Contents

- 1 What is "difficulty"?
- 2 How often does the network difficulty change?
- 3 What is the formula for difficulty?
- 4 How is difficulty stored in blocks?
- 5 How is difficulty calculated? What is the difference between bdiff and pdiff?
- 6 What is the current difficulty?
- 7 What is the maximum difficulty?
- 8 Can the network difficulty go down?
- 9 What is the minimum difficulty?
- 10 What network hash rate results in a given difficulty?
- 11 How soon might I expect to generate a block?
- 12 Why is bitcoin not designed to update the difficulty more frequently?
- 13 Related Links

### What is "difficulty"?

Difficulty is a measure of how difficult it is to find a hash below a given target.

The Bitcoin network has a global block difficulty. Valid blocks must have a hash below this target.Mining pools also have a pool-specific share difficulty setting a lower limit for shares.

### How often does the network difficulty change?

Every 2016 blocks.

### What is the formula for difficulty?

difficulty = difficulty_1_target / current_target

(target is a 256 bit number)

difficulty_1_target can be different for various ways to measure difficulty.Traditionally, it represents a hash where the leading 32 bits are zero and the rest are one (this is known as "pool difficulty" or "pdiff").The Bitcoin protocol represents targets as a custom floating point type with limited precision; as a result, Bitcoin clients often approximate difficulty based on this (this is known as "bdiff").

### How is difficulty stored in blocks?

Each block stores a packed representation (called "Bits") for its actual hexadecimal target. The target can be derived from it via a predefined formula. For example, if the packed target in the block is 0x1b0404cb (stored in little-endian order: `cb 04 04 1b`

), the hexadecimal target is

0x0404cb * 2**(8*(0x1b - 3)) = 0x00000000000404CB000000000000000000000000000000000000000000000000

Note that this packed format contains a sign bit in the 24th bit, and for example the negation of the above target would be 0x1b**8**404cb in packed format. Since targets are never negative in practice, however, this means the largest legal value for the lower 24 bits is 0x7fffff. Additionally, 0x008000 is the smallest legal value for the lower 24 bits since targets are always stored with the lowest possible exponent.

### How is difficulty calculated? What is the difference between bdiff and pdiff?

The highest possible target (difficulty 1) is defined as 0x1d00ffff, which gives us a hex target of

0x00ffff * 2**(8*(0x1d - 3)) = 0x00000000FFFF0000000000000000000000000000000000000000000000000000

It should be noted that pooled mining often uses non-truncated targets, which puts "pool difficulty 1" at

0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

So the difficulty at 0x1b0404cb is therefore:

0x00000000FFFF0000000000000000000000000000000000000000000000000000 /0x00000000000404CB000000000000000000000000000000000000000000000000 = 16307.420938523983 (bdiff)

And:

0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF /0x00000000000404CB000000000000000000000000000000000000000000000000 = 16307.669773817162 (pdiff)

Here's a fast way to calculate bitcoin difficulty. It uses a modified Taylor series for the logarithm (you can see tutorials on flipcode and wikipedia) and relies on logs to transform the difficulty calculation:

#include <iostream>#include <cmath>inline float fast_log(float val){ int * const exp_ptr = reinterpret_cast <int *>(&val); int x = *exp_ptr; const int log_2 = ((x >> 23) & 255) - 128; x &= ~(255 << 23); x += 127 << 23; *exp_ptr = x; val = ((-1.0f/3) * val + 2) * val - 2.0f/3; return ((val + log_2) * 0.69314718f);} float difficulty(unsigned int bits){ static double max_body = fast_log(0x00ffff), scaland = fast_log(256); return exp(max_body - fast_log(bits & 0x00ffffff) + scaland * (0x1d - ((bits & 0xff000000) >> 24)));}int main(){ std::cout << difficulty(0x1b0404cb) << std::endl; return 0;}

To see the math to go from the normal difficulty calculations (which require large big ints bigger than the space in any normal integer) to the calculation above, here's some python:

import decimal, mathl = math.loge = math.eprint 0x00ffff * 2**(8*(0x1d - 3)) / float(0x0404cb * 2**(8*(0x1b - 3)))print l(0x00ffff * 2**(8*(0x1d - 3)) / float(0x0404cb * 2**(8*(0x1b - 3))))print l(0x00ffff * 2**(8*(0x1d - 3))) - l(0x0404cb * 2**(8*(0x1b - 3)))print l(0x00ffff) + l(2**(8*(0x1d - 3))) - l(0x0404cb) - l(2**(8*(0x1b - 3)))print l(0x00ffff) + (8*(0x1d - 3))*l(2) - l(0x0404cb) - (8*(0x1b - 3))*l(2)print l(0x00ffff / float(0x0404cb)) + (8*(0x1d - 3))*l(2) - (8*(0x1b - 3))*l(2)print l(0x00ffff / float(0x0404cb)) + (0x1d - 0x1b)*l(2**8)

Here's an even faster way to compute the difficulty, using `std::ldexp()`

. This particular function lets you scale by a power of two almost for free, by directly adjusting the exponent on the floating point number. Thus, the difficulty calculation gets reduced to a couple integer arithmetic steps, single floating point divide, and a single scale-by-power-of-2.

/* In C, just change cmath to math.h and std::ldexp to ldexp. */#include <cmath>double difficulty(const unsigned bits) { const unsigned exponent_diff = 8 * (0x1D - ((bits >> 24) & 0xFF)); const double significand = bits & 0xFFFFFF; return std::ldexp(0x00FFFF / significand, exponent_diff);}

### What is the current difficulty?

Current difficulty, as output by Bitcoin's getDifficulty.

### What is the maximum difficulty?

There is no minimum target. The maximum difficulty is roughly: maximum_target / 1 (since 0 would result in infinity), which is a ridiculously huge number (about 2^224).

The actual maximum difficulty is when current_target=0, but we would not be able to calculate the difficulty if that happened. (fortunately it never will, so we're ok.)

### Can the network difficulty go down?

Yes it can. See discussion in target.

### What is the minimum difficulty?

The minimum difficulty, when the target is at the maximum allowed value, is 1.

### What network hash rate results in a given difficulty?

The difficulty is adjusted every 2016 blocks based on the time it took to find the previous 2016 blocks. At the desired rate of one block each 10 minutes, 2016 blocks would take exactly two weeks to find. If the previous 2016 blocks took more than two weeks to find, the difficulty is reduced. If they took less than two weeks, the difficulty is increased. The change in difficulty is in proportion to the amount of time over or under two weeks the previous 2016 blocks took to find.

To find a block, the hash must be less than the target. The hash is effectively a random number between 0 and 2**256-1. The offset for difficulty 1 is

0xffff * 2**208

and for difficulty D is

(0xffff * 2**208)/D

The expected number of hashes we need to calculate to find a block with difficulty D is therefore

D * 2**256 / (0xffff * 2**208)

or just

D * 2**48 / 0xffff

The difficulty is set such that the previous 2016 blocks would have been found at the rate of one every 10 minutes, so we were calculating (D * 2**48 / 0xffff) hashes in 600 seconds. That means the hash rate of the network was

D * 2**48 / 0xffff / 600

over the previous 2016 blocks. Can be further simplified to

D * 2**32 / 600

without much loss of accuracy.

At difficulty 1, that is around 7 Mhashes per second.

At the time of writing, the difficulty is 22012.4941572, which means that over the previous set of 2016 blocks found the average network hash rate was

22012.4941572 * 2**32 / 600 = around 157 Ghashes per second.

### How soon might I expect to generate a block?

(The eternal question.)

The average time to find a block can be approximated by calculating:

time = difficulty * 2**32 / hashrate

where difficulty is the current difficulty, hashrate is the number of hashes your miner calculates per second, and time is the average in seconds between the blocks you find.

For example, using Python we calculate the average time to generate a block using a 1Ghash/s mining rig when the difficulty is 20000:

$ python -c "print 20000 * 2**32 / 10**9 / 60 / 60.0"23.85

and find that it takes just under 24 hours on average.

- Any one grinding of the hash stands the same chance of "winning" as any other. The numbers game is how many attempts your hardware can make per second.
- You need to know the difficulty (above) and your khash/sec rate (reported by the client).
- Mining Hardware Comparison has some stats that may help you predict what you could get.

- Visit a calculator or perform the maths yourself,
- Remember it's just probability! There are no guarantees you will win every N days.

## Why is bitcoin not designed to update the difficulty more frequently?

## Related Links

- Bitcoin Difficulty History
- What is Bitcoin Mining Difficulty?
- See also: target

## FAQs

### What is difficulty Bitcoin? ›

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.

**Who sets Bitcoin difficulty? ›**

Mining difficulty in the Bitcoin network is **adjusted automatically after 2,016 blocks have been mined in the network**. An adjustment of difficulty upwards or downwards depends on the number of participants in the mining network and their combined hashpower.

**Why is Bitcoin difficulty so high? ›**

Bitcoin Mining Difficulty Up By 9%

**It also points to the participation of more miners, as the mining process becomes more computationally demanding as more come on board**. While miners may have to put in more effort, a higher mining difficulty also means that the network is more secure.

**Why did Bitcoin difficulty drop? ›**

The mining difficulty is adjusted based on the number of network participants. **If there are few miners, the difficulty will drop**. For instance, when China banned BTC mining in May 2021, the mining difficulty dropped by nearly 28 percent. However, when the number of miners increases, so does the mining difficulty.

**Can Bitcoin difficulty go down? ›**

In essence it means that the difficulty of mining a block in Bitcoin is not always the same. Sometimes it goes up, **sometimes it goes down** (although in the long term it currently tends to rise).

**How Fast Is Bitcoin difficulty increasing? ›**

Furthermore, the current hashrate following the difficulty change is around 244.03 EH/s. The **13.55%** difficulty rise was a notable increase and the largest of 2022 so far, according to records, as the second largest increase (9.32%) took place on January 20, 2022. The current Bitcoin difficulty on October 10, 2022.

**Why is Bitcoin difficult to 10 minutes? ›**

**Ten minutes was specifically chosen by Satoshi as a tradeoff between first confirmation time and the amount of work wasted due to chain splits**. After a block is mined, it takes time for other miners to find out about it, and until then they are actually competing against the new block instead of adding to it.

**How often does BTC difficulty adjust? ›**

The difficulty adjustment occurs **roughly every two weeks**, or 2,016 blocks. Given that blocks have been solved on average slightly less than the target of 10 minutes, the difficulty adjustment increased.

**How long does it take to mine 1 Bitcoin? ›**

It takes **around 10 minutes** to mine just one Bitcoin, though this is with ideal hardware and software, which isn't always affordable and only a few users can boast the luxury of. More commonly and reasonably, most users can mine a Bitcoin in 30 days.

**What affects Bitcoin the most? ›**

Bitcoin's market value is primarily affected by **how many coins are in circulation and how much people are willing to pay**. By design, the cryptocurrency is limited to 21 million coins—the closer the circulating supply gets to this limit, the higher prices are likely to climb.

### How many Bitcoins have failed? ›

Mostly, they come in the form of great fanfare and celebration, only to fail and fade away as investors and the general public move away from them due to lack long term viability. By May 24, 2022, **at least 2,421 cryptocurrencies have failed**, according to Coinopsy which tracks such failures.

**What happens when mining difficulty drops? ›**

The reduced difficulty **allows Bitcoin miners to confirm transactions using lower resources**, enabling smaller miners a fighting chance to earn the mining rewards.

**How long do Bitcoin miners last? ›**

Generally, ASIC miners are projected to last for about **3-5 years**, although your machine can last more than this range if used and maintained well enough. It could also break down within a few months if not maintained properly or used in poor conditions.

**Can Bitcoin be defeated? ›**

Just as Bitcoin has never been successfully 51% attacked, **it has also never been shut down**, even for a short amount of time. As Bitcoin is decentralised, the network as such cannot be shut down by one government.

**Can Bitcoin ever crash? ›**

Crypto markets are volatile, so **buying cryptocurrencies at any price – let alone a dip that might become a long-term trend – is risky**. While prices could return to previous levels, they could also fall even further, leaving your investment underwater.

**What would happen if the bitcoin mining difficulty never change? ›**

If there were no difficulty adjustment to make it harder to mine blocks at an increased hash power, then **bitcoins would be issued at a continually faster pace than the predetermined ten minutes**, making Bitcoin susceptible to a rising stock-to-flow ratio that plagues inflationary fiat currencies and even scarce minerals ...

**Is getting 1 Bitcoin hard? ›**

**You cannot mine just 1 Bitcoin**, instead crypto miners will mine one block, with the reward set at 6.25 BTC per block. Each Bitcoin block takes 10 minutes to mine. This means that in theory, it will take just 10 minutes to mine 1 BTC (as part of the 6.25 BTC reward).

**What coin is growing faster than Bitcoin? ›**

**Solana (SOL)** - Smart Contract Platform Offering High Transaction Speeds. Solana is possibly the fastest growing crypto coin, having provided early investors with more than 20,000% returns.

**How long would it take to crack Bitcoin? ›**

The researchers estimate that a quantum computer with 1.9 billion qubits would be necessary to crack a Bitcoin's encryption within **10 minutes**. To manage the feat within an hour, a machine with 317 million qubits would be required.

**Why is everyone scared of bitcoin? ›**

It Isn't Legal Tender

Cryptocurrency is currently not classified as actual legal tender by the United States government. This may be another of the reasons people fear cryptocurrency. Another reason people have to be afraid of cryptocurrency is because **not all countries presently accept it**.

### Why did Satoshi choose 10 minutes? ›

Ten minutes was specifically chosen by Satoshi **as a tradeoff between first confirmation time and the amount of work wasted due to chain splits**. After a block is mined, it takes time for other miners to find out about it, and until then they are actually competing against the new block instead of adding to it.

**Is it worth putting $10 in bitcoin? ›**

**Starting with $10 can be a great way to learn how to use bitcoin safely, without the risk of losing too much money**. Once you are more comfortable using bitcoin and know how to store it safely, you can add to your holdings.

**How many Bitcoins are left? ›**

Total BTC in Existence | 19,203,168.75 |
---|---|

Bitcoins Left to Be Mined | 1,796,831.3 |

% of Bitcoins Issued | 91.444% |

New Bitcoins per Day | 900 |

Mined Bitcoin Blocks | 762,507 |

**How can I get 1 Bitcoin for free? ›**

**Here are some popular and genuine ways to earn free Bitcoins:**

- #1) Pionex – Use Bitcoin Growth Trading Bot to Earn Bitcoin.
- #2) Bitstamp – Using Staking Rewards.
- #3) Tipping Bots And Platforms.
- #4) Playing Online and Offline Games.
- #5) Mining Browsers And Free Mining Software.
- #6) Earning Free Bitcoins Through Bounties.

**Can I mine Bitcoin on my phone? ›**

**Crypto mobile mining can be performed on iOS and Android systems via solo or pool mining services**. are created using a distributed computing process called mining.

**What can go wrong with Bitcoin? ›**

**If a hard drive crashes, or a virus corrupts data , and the wallet file is corrupted**, Bitcoins have essentially been “lost”. There is nothing that can done to recover it. These coins will be forever orphaned in the system. This can bankrupt a wealthy Bitcoin investor within seconds with no way form of recovery.

**What happens to Bitcoin if the Internet crashes? ›**

The blockchain is a “chain” of these blocks that records all transactions. If the Internet dies, **you won't be able to send or receive any cryptos**. You won't be able to store them in a digital wallet. You won't be able to trade them for other cryptocurrencies or sell them for any other currency.

**Is Bitcoin a high risk? ›**

**Bitcoin is extremely volatile and high risk**. It's certainly not a good idea to invest all of your savings in cryptocurrency. If you are willing to take the risk, first make sure you understand what you are investing in and have a crypto investment strategy.

**What coin will explode in 2022? ›**

**Calvaria (RIA)** - New Play to Earn Cryptos with Potential to Explode in 2022. Uniglo.io - Multi-Asset Backed DAO Ready to List in Top 150. Tamadoge (TAMA) - Exciting Meme Coin Project Pumping since IEO. Battle Infinity (IBAT) - NFT-Based Sports Fantasy P2E Platform and Ecosystem.

**What makes a Bitcoin go up? ›**

The value of cryptocurrency is determined by supply and demand, just like anything else that people want. **If demand increases faster than supply**, the price goes up.

### Can a cryptocurrency go to zero? ›

We've established that **the value of crypto can never fall below zero**. But investors can lose money on crypto investments and see a negative balance depending on their investing strategy.

**What happens every 4 years with Bitcoin? ›**

After every 210,000 blocks mined, or roughly every four years, **the block reward given to Bitcoin miners for processing transactions is cut in half**. This event is referred to as halving because it cuts in half the rate at which new bitcoins are released into circulation.

**Can a crypto coin disappear? ›**

As we've learned in the article above, **there seems to be a consensus that cryptocurrencies are here to stay** – that said, their total market capitalisation could diminish. And, of course, individual coins crash and burn at any time.

**How much Bitcoin can I mine in a day? ›**

How many Bitcoin can you mine a day? Based the mining hardware inputs provided, **0.00047881 Bitcoin** can be mined per day with a Bitcoin mining hashrate of 140.00 TH/s, a block reward of 6.25 BTC, and a Bitcoin difficulty of 36,762,198,818,467.00.

**What is the biggest problem in mining? ›**

Mining is a dangerous profession. The traditional occupational hazards such as **coal dust inhalation**, damage to hearing due to the noise in a mine and chemical hazards still stand but the changing nature of mining has led to a raft of new issues.

**Does difficulty increase drop rate? ›**

We've responded in different threads, but since it's such a common question, we wanted to make a more in-depth post clarifying it. The short answer is that **changing your difficulty setting doesn't affect your loot from each machine drop**.

**What happens if all Bitcoin is mined? ›**

**Bitcoin mining fees will disappear when the Bitcoin supply reaches 21 million**. Miners will likely earn income only from transaction processing fees, rather than a combination of block rewards and transaction fees. PlanetCrypto. "How Many Bitcoin Are Left in 2022?"

**What happens if no one mines Bitcoin? ›**

If miners stopped mining then **bitcoin would die** because miners mine new bitcoin but they keep the system running by confirming transactions. If they stop confirming then the system falls apart.

**Do Bitcoin miners get paid? ›**

**If a miner is able to successfully add a block to the blockchain, they will receive 6.25 bitcoins as a reward**. The reward amount is cut in half roughly every four years, or every 210,000 blocks. As of September 2022, Bitcoin traded at around $20,000, making 6.25 bitcoins worth $125,000.

**How does Bitcoin calculate difficulty? ›**

Average time of finding a single block can be calculated using this formula: **time = difficulty * 2**32 / hashrate** where 'difficulty' is the current cryptocurrency difficulty level of BTC difficulty network and 'hashrate' is the amount of hashes a miner finds per second.

### Is ethereum a difficulty? ›

Mining difficulty **measures the average number of hashes required to “solve” a block**. Litecoin miners compete by generating random hashes to find one lower than the target set by the network's mining algorithm.

**How many bitcoins have failed? ›**

Mostly, they come in the form of great fanfare and celebration, only to fail and fade away as investors and the general public move away from them due to lack long term viability. By May 24, 2022, **at least 2,421 cryptocurrencies have failed**, according to Coinopsy which tracks such failures.