Bitcoin Forum
December 11, 2016, 11:53:37 AM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: How is chain length calculated?  (Read 822 times)
Hello1024
Newbie
*
Offline Offline

Activity: 2


View Profile
June 08, 2011, 02:32:55 PM
 #1

If my understanding is correct, clients assume the currently longest chain is authoritative.  The chain with most peers working on it gets longer quicker, and therefore anyone on any other chain "switches" to the longest.  This is a clever way to ensure no "forks" exist for long.

Difficulty is calculated based on how many blocks have been calculated in the past week/2 weeks, to keep a global target of around 1 block every 10 mins.


If I were to start a new isolated firewalled bitcoin network, working from the same base block as the existing network, with only a single slow host working on it, the chain would still get longer by 1 block every 10 minutes, since the difficulty would adjust after 2 weeks to ensure this.

If I now tweak the system clock to go at double-speed, the difficulty will re-adjust to make generation yet easier, and a block will be generated every 5 minutes.  I now have the possibility for my chain to catch up and overtake the official one.  When this happens, I unfirewall my host, upload all my blocks to the network, and all the clients see my chain as longer, and therefore authorative.

How does the network protect against this?  Is the "chain length" actually a function of both difficulty and length in blocks?
1481457217
Hero Member
*
Offline Offline

Posts: 1481457217

View Profile Personal Message (Offline)

Ignore
1481457217
Reply with quote  #2

1481457217
Report to moderator
1481457217
Hero Member
*
Offline Offline

Posts: 1481457217

View Profile Personal Message (Offline)

Ignore
1481457217
Reply with quote  #2

1481457217
Report to moderator
1481457217
Hero Member
*
Offline Offline

Posts: 1481457217

View Profile Personal Message (Offline)

Ignore
1481457217
Reply with quote  #2

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

Posts: 1481457217

View Profile Personal Message (Offline)

Ignore
1481457217
Reply with quote  #2

1481457217
Report to moderator
1481457217
Hero Member
*
Offline Offline

Posts: 1481457217

View Profile Personal Message (Offline)

Ignore
1481457217
Reply with quote  #2

1481457217
Report to moderator
1481457217
Hero Member
*
Offline Offline

Posts: 1481457217

View Profile Personal Message (Offline)

Ignore
1481457217
Reply with quote  #2

1481457217
Report to moderator
Pieter Wuille
Legendary
*
qt
Offline Offline

Activity: 1036


View Profile WWW
June 08, 2011, 07:33:52 PM
 #2

The chain length is defined as the expected (in the statistical meaning) number of hashes performed to create it. This is proportional to the sum of the difficulties of all blocks.

aka sipa, core dev team

Tips and donations: 1KwDYMJMS4xq3ZEWYfdBRwYG2fHwhZsipa
Hello1024
Newbie
*
Offline Offline

Activity: 2


View Profile
June 09, 2011, 12:15:52 PM
 #3

That solves that mystery!  Thankyou.
Sukrim
Legendary
*
Offline Offline

Activity: 1848


View Profile
June 09, 2011, 12:32:03 PM
 #4

If I were to start a new isolated firewalled bitcoin network, working from the same base block as the existing network, with only a single slow host working on it, the chain would still get longer by 1 block every 10 minutes, since the difficulty would adjust after 2 weeks to ensure this.
Also difficulty changes only every 2016 blocks - not every 2 weeks. It is expected that hash rates grow/decrease within limits (= not moving from a few Terahashes/s to a few Megahashes/s in your example). also the new difficulty takes into consideration the average time it took to calculate the past 2016 blocks. For the difficulty to go down by 50%, the last 2016 blocks would need to be solved within 4 weeks, instead of 2.

The Bitcoin blockchain is essentially a global clock, where it is ensured more or less that it's hard enough for members to trigger a "tick" at the same time - and if they do, the network will solve it on it's own.

To be able to build a longer Blockchain than the official one, you need more hashing power than the rest of the network. This is also known as the "51% attack" and which is why people are currently worried that deepbit might become (again) big enough to do this in theory. In practice, deepbit will most likely NOT pull off a stunt like that, but it still poses some dangers and insecurities.

https://bitfinex.com <-- leveraged trading of BTCUSD, LTCUSD and LTCBTC (long and short) - 10% discount on fees for the first 30 days with this refcode: x5K9YtL3Zb
Mail me at Bitmessage: BM-BbiHiVv5qh858ULsyRDtpRrG9WjXN3xf
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!