Bitcoin Forum
December 08, 2016, 08:15:02 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: How is difficulty agreed upon?  (Read 1071 times)
phathash
Member
**
Offline Offline

Activity: 75


View Profile
May 23, 2011, 09:37:12 PM
 #1


After 2016 blocks, what is the process? Does the miner calculate the difficulty? How is it trusted?

Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481184902
Hero Member
*
Offline Offline

Posts: 1481184902

View Profile Personal Message (Offline)

Ignore
1481184902
Reply with quote  #2

1481184902
Report to moderator
Pieter Wuille
Legendary
*
qt
Offline Offline

Activity: 1036


View Profile WWW
May 23, 2011, 09:43:24 PM
 #2

The difficulty is calculated through a formula that is based purely on information in the block chain, and is only valid within a particular branch of the block chain. Since everybody has this information, everybody just calculates it and verifies it for each incoming block. So the answer is: everyone.

aka sipa, core dev team

Tips and donations: 1KwDYMJMS4xq3ZEWYfdBRwYG2fHwhZsipa
k
Sr. Member
****
Offline Offline

Activity: 452


View Profile
May 23, 2011, 09:50:23 PM
 #3

 i think it's something like this.

expected time for 2016 blocks = 14 days
actual time= 10 days say

difficulty increase = 14/10 = 1.4

new difficulty = old difficulty x difficulty increase

for the previous difficulty change the numbers were something like


9.02751 days for 2016 blocks
difficulty before last change 157,426

new difficulty = 157,426 * (14/9.0275) = 244,139

bittrader
Jr. Member
*
Offline Offline

Activity: 42



View Profile
May 23, 2011, 11:09:35 PM
 #4

In other words, all clients have it hardcoded in them that every 2016 blocks, they need to figure out by what percentage the actual timespan for creating those blocks varied from two weeks. The current difficulty is then multiplied by that percentage to get the new difficulty. All the clients will then only accept new blocks that meet the new difficulty requirement.

Usually, everyone knows about the length of the block chain at the same time, so everyone does the same calculation to know the next difficulty. If one client were to try to "cheat", and not raise the difficulty when it should be raised, it would make no difference to the network at large. They would all simply reject blocks that that client would generate if they didn't meet the difficulty that had been calculated by the rest of the network.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!