Bitcoin Forum
October 23, 2017, 11:16:21 PM
 News: Latest stable version of Bitcoin Core: 0.15.0.1  [Torrent]. (New!)
 Home Help Search Donate Login Register
 Pages: [1]
 Author Topic: How is difficulty agreed upon?  (Read 1136 times)
phathash
Member

Offline

Activity: 75

 May 23, 2011, 09:37:12 PM

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.
1508800581
Hero Member

Offline

Posts: 1508800581

Ignore
 1508800581

1508800581
 Report to moderator
1508800581
Hero Member

Offline

Posts: 1508800581

Ignore
 1508800581

1508800581
 Report to moderator
Pieter Wuille
Legendary

Offline

Activity: 1050

 May 23, 2011, 09:43:24 PM

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

Activity: 452

 May 23, 2011, 09:50:23 PM

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

Jr. Member

Offline

Activity: 42

 May 23, 2011, 11:09:35 PM

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]
 « previous topic next topic »