Bitcoin Forum
March 29, 2024, 08:18:23 AM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: how does difficulty work exactly?  (Read 4498 times)
1905 (OP)
Full Member
***
Offline Offline

Activity: 198
Merit: 100


Give him a mask and he will tell you the truth.


View Profile
August 25, 2011, 03:09:42 AM
 #1

i need to explain how difficulty works exactly. How does it calculate what the next difficulty will be and under what circumstances does it lower etc.

Man is least himself when he talks in his own person. Give him a mask and he will tell you the truth.

- Oscar Wilde
1711700303
Hero Member
*
Offline Offline

Posts: 1711700303

View Profile Personal Message (Offline)

Ignore
1711700303
Reply with quote  #2

1711700303
Report to moderator
1711700303
Hero Member
*
Offline Offline

Posts: 1711700303

View Profile Personal Message (Offline)

Ignore
1711700303
Reply with quote  #2

1711700303
Report to moderator
Be very wary of relying on JavaScript for security on crypto sites. The site can change the JavaScript at any time unless you take unusual precautions, and browsers are not generally known for their airtight security.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
SomeoneWeird
Hero Member
*****
Offline Offline

Activity: 700
Merit: 500


View Profile
August 25, 2011, 03:59:07 AM
 #2

i need to explain how difficulty works exactly. How does it calculate what the next difficulty will be and under what circumstances does it lower etc.

https://en.bitcoin.it/wiki/Difficulty
paulkoan
Newbie
*
Offline Offline

Activity: 43
Merit: 0



View Profile WWW
September 10, 2012, 04:23:22 AM
 #3

I have read that, and still don't fully get what difficulty is.  It is described as the difficulty in processing the next block - it which case it is just a measure.  But it is also described as a mechanism for ensuring that blocks are not uncovered to quickly - in which case it influences difficulty rather than measures it.

If it influences difficulty, and is based on how long previous blocks took to uncover, then how is this orchestrated through the network - how does everyone agree how long a block took?
obisunk
Newbie
*
Offline Offline

Activity: 23
Merit: 0



View Profile
September 10, 2012, 04:50:06 AM
 #4

From what I understand:

Given the same hashrate, doubling the difficulty means doubling the time.  Therefore, you can say that difficulty scales linearly with time.

My assumption is based on the formula
Code:
time = difficulty * 2^32 / hashrate
listed on (https://en.bitcoin.it/wiki/Difficulty)

Example:
The current difficulty is ~2.7 million (http://bitcoincharts.com/ shows the difficulty number in the topmost dash).  If the difficulty doubled to 5.4 million and the network hashrate remained the same, then the expected time to solve a block would double (the expected number of blocks solved per unit time would be halved).

(edited for clarity)
JoelKatz
Legendary
*
Offline Offline

Activity: 1596
Merit: 1012


Democracy is vulnerable to a 51% attack.


View Profile WWW
September 10, 2012, 04:52:18 AM
 #5

If it influences difficulty, and is based on how long previous blocks took to uncover, then how is this orchestrated through the network - how does everyone agree how long a block took?
The blocks are timestamped.

I am an employee of Ripple. Follow me on Twitter @JoelKatz
1Joe1Katzci1rFcsr9HH7SLuHVnDy2aihZ BM-NBM3FRExVJSJJamV9ccgyWvQfratUHgN
tiberiandusk
Hero Member
*****
Offline Offline

Activity: 575
Merit: 500


The North Remembers


View Profile WWW
September 10, 2012, 04:57:02 AM
 #6

It is adjusted to keep the average time to find a block at 10 min.

Bitcoin Auction House http://www.BitBid.net BTC - 1EwfBVC6BwA6YeqcYZmm3htwykK3MStW6N | LTC - LdBpJJHj4WSAsUqaTbwyJQFiG1tVjo4Uys Don't get Goxed.
paulkoan
Newbie
*
Offline Offline

Activity: 43
Merit: 0



View Profile WWW
September 10, 2012, 05:00:36 AM
 #7

If it influences difficulty, and is based on how long previous blocks took to uncover, then how is this orchestrated through the network - how does everyone agree how long a block took?
The blocks are timestamped.

By whom?  Or more clearly, how are clock errors in participants reduced, does the network agree what time it is somehow?
dotcom
Sr. Member
****
Offline Offline

Activity: 354
Merit: 250



View Profile
September 10, 2012, 05:02:24 AM
 #8

i've been interested in this too
JoelKatz
Legendary
*
Offline Offline

Activity: 1596
Merit: 1012


Democracy is vulnerable to a 51% attack.


View Profile WWW
September 10, 2012, 05:02:44 AM
 #9

By whom?  Or more clearly, how are clock error in participants reduced, does the network agree what time it is somehow?
Each block is timestamp by the entity that mined it. The block is accepted if the timestamp is roughly correct. Every 2,016 blocks, difficulty is adjusted based on the timestamps of the blocks to keep the average block mining rate at one per ten minutes. There's a slight oversimplification in the algorithm that results in the block discovery rate being a little higher than this if network hash rate is increasing.

I am an employee of Ripple. Follow me on Twitter @JoelKatz
1Joe1Katzci1rFcsr9HH7SLuHVnDy2aihZ BM-NBM3FRExVJSJJamV9ccgyWvQfratUHgN
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1063


Gerald Davis


View Profile
September 10, 2012, 05:06:29 AM
 #10

By whom?  Or more clearly, how are clock errors in participants reduced, does the network agree what time it is somehow?

Blocks are timestamped by the person solving it.  The network does maintain a "network average time" which all nodes share so the timestamp of any new block can't deviate by more than 3 hours from network time.

The network attempts to solve one block per ten minutes.  Every 2016 blocks difficulty is recalculated.  The timestamp between the first and last block should be 2016 * 10 = 20,160 minutes (~14 days).  The difficulty necessary to make the prior 2016 blocks exactly 20,160 minutes is computed and that becomes the difficulty for the next 2016 blocks.

It is possible to spoof the timestamp of a block but only by so much.  An attacker can't really influence difficulty by any meaningful way because only the first and last block matter and they can only deviate from network time by more than 3 hours.
natd
Full Member
***
Offline Offline

Activity: 182
Merit: 102


View Profile
December 08, 2013, 08:31:08 PM
 #11

 Can the difficulty go down as well?

In search of light in cryptocurrency.
VolanicEruptor
Sr. Member
****
Offline Offline

Activity: 392
Merit: 250



View Profile
December 08, 2013, 08:34:53 PM
 #12

Just imagine 25 bitcoins falling out of the sky every 10 minutes.  
The more people there are who want these, the harder it is for each individual to catch a reasonable share. 
At this rate, all of our energy resources will be drained just so we can continue catching them with better efficiency.  In this sense, bitcoin is a virus about to destroy our world.  Smiley

alexb___
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
December 08, 2013, 08:46:08 PM
 #13

Can the difficulty go down as well?
I tink it depends of the coins. For bitcoin, it can not. even if you stop mining.
musicchimp
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
December 08, 2013, 09:00:13 PM
 #14

That's a very good question but difficult to answer. I'll try and get back to you but it might be difficult
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1063


Gerald Davis


View Profile
December 08, 2013, 09:08:10 PM
 #15

Can the difficulty go down as well?
I tink it depends of the coins. For bitcoin, it can not. even if you stop mining.

That is not correct. Difficulty can (and has) gone down. 

If the hashrate of the network doubles, then the time between blocks will be cut in half and next adjustment difficulty will double.
If the hashrate of the network is cut in half, then the time between blocks will double, and next adjustment difficulty will be cut in half.
dark143i
Jr. Member
*
Offline Offline

Activity: 56
Merit: 1


View Profile
December 08, 2013, 09:42:43 PM
 #16

Can the difficulty go down as well?

Yes, When I was farming difficulty changed. Went down and up too. So definitely can go down. I hope that answers your question.  Smiley
USB mining
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
December 08, 2013, 10:29:48 PM
 #17

thanks for answers, I was looking for this a long time ago.
natd
Full Member
***
Offline Offline

Activity: 182
Merit: 102


View Profile
December 08, 2013, 10:51:48 PM
 #18

thanks for answers, I was looking for this a long time ago.

ditto

In search of light in cryptocurrency.
Lander12
Newbie
*
Offline Offline

Activity: 7
Merit: 0


View Profile
April 27, 2014, 09:18:35 PM
 #19

Long time no post on this but need to ask a question on this topic.

Hypothetical - if Bitcoin takes a hard of enough crash to stop 95% of miners from mining it stops the block-chain from publishing new blocks and paying the other 10% of miner. I see this with other dead or dieng sha-256 coins out there which the block chain is frozen because the difficulty is "stuck" at a High level where its going to take years for the 2016 block to be reached. If BTC falls into this situation are there any plans to keep blocks moving at 1 per 10 mins if a crazy drop in mining power would happen and average block time goes into weeks? I was looking at the failure byte coin which got me thinking.         
cookiemonsterwhat
Sr. Member
****
Offline Offline

Activity: 252
Merit: 250


View Profile
April 28, 2014, 02:42:26 AM
 #20

Despite knowing it, these days you can just go to bitcoinwisdom and it`ll state the next difficulty hike

It also explains the #`s on percent.

Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!