Questions tagged [difficulty-retargetting]

43 questions
75
votes
3 answers

How is difficulty calculated?

Can anyone explain me in the plain English how difficulty is calculated. I have a very approximate understanding that it is calculated based on the amount of hash power in all the bitcoin community over a specific period of time. But this is very…
Salvador Dali
  • 3,320
  • 7
  • 30
  • 49
21
votes
1 answer

Gaming the "off-by-one" bug (difficulty re-target based on 2015 instead of 2016 block time span)?

In this forum post from Gavin Andresen he writes: Second: I've written 'discourage blocks' infrastructure: https://github.com/gavinandresen/bitcoin-git/tree/discourageblocks (code reviews welcome) ... which should give us the ability to…
14
votes
5 answers

Why not retarget on every block?

Should make things smoother and result in less oscillation. Is there a reason why retargetting is only every 2016 blocks?
kermit
  • 2,009
  • 1
  • 17
  • 26
11
votes
2 answers

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

Difficulty or target is implied by chain history, so why does it need to be explicit in the header? I suppose it exposes miner-intended-difficulty, but I don't see why that would be relevant without chain context. So it seemingly represents…
James C.
  • 2,501
  • 1
  • 6
  • 18
7
votes
4 answers

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

Is there a benefit to adjusting the difficulty every so often (ie 2 weeks) vs adjusting the difficulty every block?
B T
  • 1,569
  • 13
  • 27
5
votes
2 answers

Does Cryptocurrency really need timestamps?

Bitcoin is supposed to be a clock on it's own right so it always felt sketchy to me that outside time is referenced. Could bitcoin be aware of it's own block interval through something like uncle block rate? Could that allow it to do difficulty…
veoex
  • 51
  • 3
5
votes
1 answer

When will the Bitcoin Cash difficulty adjust next?

Bitcoin Cash adjusts its difficulty downwards if there is, roughly speaking, a 12 hour gap between blocks. At least that's my understanding. Difficulty has dropped to about a quarter of what it was because if that and more blocks are coming in…
boot4life
  • 509
  • 1
  • 3
  • 11
5
votes
2 answers

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

From Bitcoin's whitepaper I've gathered that the hash of a block must start with a certain number of zeroes. And that this number of zeroes is adjusted every 2 weeks. Consequently the hash target is a power of two. Requiring an extra zero for the…
Fred
  • 133
  • 1
  • 5
4
votes
2 answers

Bitcoin Difficulty granularity

Difficulty adjusts by very granular percentages to target for 10 minutes blocks. But adding another zero at the end of the chain of zeroes from the header hash requirement for a valid block would increase the difficulty exponential. So how does the…
zndtoshi
  • 153
  • 6
4
votes
3 answers

Would it be possible to retarget difficulty in real time?

Could the mining difficulty adjust in real time, not only when blocks are found? (NOTE: Not asking about retargetting after every block but continuously as a function of time.) I'm worried about how Bitcoin (and many other cryptos) change the…
4
votes
0 answers

Why does bitcoin limit the difficulty adjustment to a factor of four?

from here: https://github.com/bitcoin/bitcoin/blob/master/src/pow.cpp // Limit adjustment step int64_t nActualTimespan = pindexLast->GetBlockTime() - nFirstBlockTime; if (nActualTimespan < params.nPowTargetTimespan/4) nActualTimespan =…
Tue Minh
  • 41
  • 1
3
votes
1 answer

where is the adjustment calculation for the target value in the source code?

Can someone point me to the source code and explain how the average is calculated for the adjustment of difficulty that takes place every 2016 ? Update: i have consulted with previous questions but it has not been documented properly and I am not…
3
votes
1 answer

Rewriting the entire blockchain: is it possible to spoof block timestamps of a privately mined chain?

According to fork.lol and Pieter's bitcoin.sipa, it would currently take ~200 days for an attacker with 100% of the current hashpower to rewrite the entire btc blockchain. My question pertains to how an attack like this could actually play out: Lets…
chytrik
  • 17,910
  • 3
  • 18
  • 47
3
votes
1 answer

Why max target is not (2^256 - 1)?

I'm reading https://en.bitcoin.it/wiki/Difficulty And I don't get why max target is not (2^256 - 1) which is 0xFFFFFFFFFFFF... but 0x00000000FFFF...?
ycshao
  • 145
  • 1
  • 4
3
votes
2 answers

How to calculate nBits from target?

I was wondering how the nBits are calculated from the target, I know how the the target is calculated from nBits, but how is the nBits calculated from the target?
1
2 3