Bitcoin Forum
May 25, 2024, 04:31:35 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How is difficulty agreed upon?  (Read 1292 times)
phathash (OP)
Member
**
Offline Offline

Activity: 75
Merit: 10


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?

Pieter Wuille
Legendary
*
qt
Offline Offline

Activity: 1072
Merit: 1174


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.

I do Bitcoin stuff.
k
Sr. Member
****
Offline Offline

Activity: 451
Merit: 250


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
Merit: 1



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:  

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