37 votes
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 ...
hardfork's user avatar
  • 2,117
22 votes

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 ...
gary's user avatar
  • 529
16 votes
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: ...
Jimmy Song's user avatar
  • 7,759
16 votes
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 ...
Ava Chow's user avatar
  • 70.3k
14 votes
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 ...
meshcollider's user avatar
  • 11.8k
14 votes

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 ...
chytrik's user avatar
  • 18.1k
12 votes
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 ...
Ava Chow's user avatar
  • 70.3k
11 votes

How many zeroes does the current target have?

17 judging by the latest blocks published on blockchain.info: https://blockchain.info/block/0000000000000000057fcc708cf0130d95e27c5819203e9f967ac56e4df598ee
derrend's user avatar
  • 696
11 votes
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.
inersha's user avatar
  • 3,063
10 votes

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 ...
Ava Chow's user avatar
  • 70.3k
9 votes
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 (...
Pieter Wuille's user avatar
9 votes

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 ...
Shabahat M. Ayubi's user avatar
8 votes
Accepted

Is there actual consensus on the blockchain's tip or only until the next block?

No, there is no consensus until the next block is found. The network is experiencing a blockchain-fork. It will only mend once one of the tips pulls ahead by adding another block. Then all nodes will ...
Murch's user avatar
  • 75.1k
8 votes
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 ...
Pieter Wuille's user avatar
8 votes

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 ...
Ava Chow's user avatar
  • 70.3k
7 votes

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 ...
giancarloGiuffra's user avatar
7 votes
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 ...
nicetrader's user avatar
7 votes
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 ...
Jestin's user avatar
  • 8,802
7 votes
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 ...
Murch's user avatar
  • 75.1k
7 votes
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 ...
Murch's user avatar
  • 75.1k
7 votes

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 ...
G. Maxwell's user avatar
  • 7,727
7 votes

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 ...
Murch's user avatar
  • 75.1k
7 votes
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 ...
Ava Chow's user avatar
  • 70.3k
6 votes
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 ...
Steve Ellis's user avatar
  • 1,062
6 votes

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 ...
Ava Chow's user avatar
  • 70.3k
6 votes
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 ...
Dani Eder's user avatar
6 votes

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 ...
Pau Coma Ramirez's user avatar
6 votes
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 ...
meshcollider's user avatar
  • 11.8k
6 votes

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 ...
Ava Chow's user avatar
  • 70.3k

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