Share Your Experience: Take the 2024 Developer Survey

# Tag Info

Accepted

### Can bitcoin exist without miners?

if in the coming years the difficulty increases so much that mining is no longer profitable That's not really possible. The mining power is set so that the miners need 10 minutes in average to mine a ...
• 2,117

### How is difficulty calculated?

Meni's answer is good. I just want to give some practical detail method about difficulty calculation, perhaps helpful for future views of this question's answer. Let's take a look at Satoshi's genesis ...
• 529
Accepted

### How is a block header hash compared to the target (bits)?

How to calculate the target from bits Let's start with a block-header, always 80-bytes that looks like this: ...
• 7,759
Accepted

### Isn't Bitcoin's hash target supposed to be a power of 2?

Contrary to popular belief, the target is not actually based on the number of leading zeroes. This is a major simplification that is used to get the general idea across, but is not actually how the ...
• 70.8k
Accepted

### Why is it harder to compute nonce for a hash with a certain number zero prefixes than it is for any other hash?

A hash is 256 bits long, so there are 2^256 possible hashes in the hash space. But if you assert that the hash has to begin with a 0, that halves the number of hashes that are allowed (and thus ...
• 11.8k

### Isn't Bitcoin's hash target supposed to be a power of 2?

As Andrew's answer points out, the 'number of leading zeros' is just a simplification, so I thought I would give an example to more concretely illustrate this: Block hashes are usually represented in ...
• 18.3k
Accepted

### Why are block header bits necessary? (Valid difficulty is already implied by chain history)

They aren't really necessary. The reason that they are included can only be known by Satoshi, and AFAIK, he did not state why he chose to include nBits in the block header (or many other things that ...
• 70.8k

### How many zeroes does the current target have?

17 judging by the latest blocks published on blockchain.info: https://blockchain.info/block/0000000000000000057fcc708cf0130d95e27c5819203e9f967ac56e4df598ee
• 696
Accepted

### Why didn't the difficulty adjust for the first 30,240 blocks?

Because blocks were not being mined in less than 10 minutes on average during this time (so the difficulty would only decrease and not increase), and the difficulty cannot go lower than 1.
• 3,155

### Why this ugly looking formula to calculate 'target' from 'nBits' in block header: target = coefficient * 256**(exponent-3)

TL;DR The formula comes from turning an algorithm into a mathematical formula. nBits encodes the target with the first bytes as the size of the final target, followed by the 3 most significant bytes ...
• 70.8k
Accepted

### Why is target stored in the block at all?

You're presenting it as a choice between either allowing miners to choose the difficulty, or having it be implied by previous history. In fact, neither is true. The target is determined by history (...
• 106k

### Testnet difficulty change

Testnet has a built in functionality that changes the difficulty to 1 if the mining process takes 20 minutes or longer. This question explains the dropping of difficulty to 1. So while the ...
• 1,479
Accepted

### Is there a rationale for the compact representation of the target?

It looks like the format was designed for other purposes than Bitcoin's target, and used unmodified in the code. If you want a rationale for why a compact representation in the first place: not to ...
• 106k

### understanding bits and difficulty in a block header

Contrary to popular belief, Bitcoin's proof of work is not actually based on the number of zeroes. Rather the block hash, when interpreted as a 256 bit integer, must be less than the target value. The ...
• 70.8k
Accepted

### How can I forecast the date Bitcoin will hit a certain blockheight?

Take the difference (in days) between the current date and the date you are trying to estimate the block height for. Then multiple that difference by 24 hours and by 6 (6 blocks per hour) Current ...
• 241

### How is difficulty calculated?

I would like to give my 2 cents here, by expliciting the relationship between the probability of mining a block given the current target t and the corresponding difficulty d as it is calculated in ...
Accepted

### Why was the maximum target set to 0xffff0000000...?

I admit that I don't know for sure, but I have a guess. Since Satoshi was mining by himself for the first blocks, he probably set the initial target to whatever would take approximately 10 minutes to ...
• 8,812
Accepted

### What does the nBits value represent?

nBits refers to the target. The target is inversely proportional to the difficulty, and is encoded as a compact representation of a 256-bit number. The first byte of the 32-bit field represents an ...
• 75.7k
Accepted

### Why is difficulty measured in a hashâ€™s leading zeroes?

The "leading zeros" are a simplification. The difficulty is encoded as a target which is essentially a 256 bit number. Since block hashes are produced by SHA-256, they're also a string of 256 bits. If ...
• 75.7k

### Why aren't block hashes used directly as scores for difficulty purposes?

The "apparent" work is 2x higher than actual work due to luck, but the reason it's good bitcoin doesn't use the apparent work is because it has bad stability properties due to variance, and bad game ...
• 7,727

### Would Bitcoin still work without a target difficulty?

It's not trivial a) to agree on the time in a distributed system, especially how much time has passed between two events, b) to establish when exactly a block candidate was found. Further, when a node ...
• 75.7k
Accepted

### Bitcoin difficulty - why leading 0s?

Not understanding the math behind it in-depth, the best answer I can come up with is that the protocol requires that the proof of work hash (hash of nonce and block data) should be equal to or lower ...
• 70.8k
Accepted

### Why not decrease the difficulty to increase capacity?

One problem is that lower block times mean an increased chance of forking, which makes head of the chain, and the system, less reliable. Another problem is that it normally takes a block a few ...
• 1,072

### How does solving reduced difficulty hashes contribute to solving a block?

Contrary to popular belief, mining is not something where there is progress. Each hash has the same probability of being a valid block hash. You could get lucky and find a valid hash with your next ...
• 70.8k
Accepted

### When will the Bitcoin Cash difficulty adjust next?

The original bitcoin adjusted difficulty every 2016 blocks, which would nominally be 14 days @ 6 blocks per hour. The 238th such adjustment is due at block 479,808, and we are presently (early 4 Aug ...

### How to select minimum difficulty when mining with Slush Pool

From the research I have done to understand the minimum difficulty it boils down to a balance between server/client bandwidth limitations and time to put at risk. The pool which you connect to ...
Accepted

### How is mining difficulty defined (formula)?

The nBits field is basically scientific notation in base-256 (256 is 2^8). As an example, we take the one found on the Bitcoin.org Developer Reference: 0x181bc330 (Big-Endian order). This is split ...
• 11.8k

### Why was it chosen to adjust difficulty every 2 weeks (rather than 2 days or every few blocks)?

Yes, there is a risk with adjusting the difficulty every block. It entirely depends on the method of adjusting. With how Bitcoin does it, if you adjusted every block, the difficulty would vary wildly ...
• 70.8k
Accepted

### Why aren't block hashes used directly as scores for difficulty purposes?

Background info: The block hash must be less than a certain value (as defined by the difficulty function) in order for the block to be valid. Generally, as time has progressed, network difficulty ...
• 18.3k

Only top scored, non community-wiki answers of a minimum length are eligible