Bitcoin Forum
December 14, 2017, 05:15:50 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Cumulative difficulty shouldn't be used to choose the "main" blockchain  (Read 2268 times)
Come-from-Beyond
Legendary
*
Offline Offline

Activity: 1792

Newbie


View Profile
October 12, 2013, 01:28:28 PM
 #1

Let's assume that we have a cryptocoin with a 3-block retarget period and 10 minutes between blocks.

A first blockchain looks like:

0th block: timestamp 00:00, difficulty 1   <- first block after retarget
1st block: timestamp 00:05, difficulty 1
2nd block: timestamp 00:10, difficulty 1
3rd block: timestamp 00:20, difficulty 2   <- first block after retarget
4th block: timestamp 00:30, difficulty 2
5th block: timestamp 00:40, difficulty 2

Cumulative difficulty = 1 + 1 + 1 + 2 + 2 + 2 = 9
Hashes calculated (excluding 0th block) = N + N + 2N + 2N + 2N = 8N
Time spent = 00:40 - 00:00 = 40 minutes
Hashpower wasted = 8N / 40 = 0.2N hash/min

A second one looks like:

0th block: timestamp 00:00, difficulty 1   <- first block after retarget
1st block: timestamp 00:10, difficulty 1
2nd block: timestamp 00:20, difficulty 1
3rd block: timestamp 00:30, difficulty 1   <- first block after retarget
4th block: timestamp 00:40, difficulty 1
5th block: timestamp 00:50, difficulty 1
6th block: timestamp 01:00, difficulty 1   <- first block after retarget
7th block: timestamp 01:10, difficulty 1
8th block: timestamp 01:20, difficulty 1

Cumulative difficulty = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 = 9
Hashes calculated (excluding 0th block) = N + N + N + N + N + N + N + N = 8N
Time spent = 01:20 - 00:00 = 80 minutes
Hashpower wasted = 8N / 80 = 0.1N hash/min

Which blockchain is better? If you take into account the cumulative difficulty you can choose the second one, which looks a bad choice coz it requires hardware with lower "intensity" of hashing. But if we took squares of the difficulty of each block we would definitely choose the first blockchain (15 vs 9).

You may ask why squares? Well... I think there is a mystical connection to http://en.wikipedia.org/wiki/Least_squares. Smiley
1513228550
Hero Member
*
Offline Offline

Posts: 1513228550

View Profile Personal Message (Offline)

Ignore
1513228550
Reply with quote  #2

1513228550
Report to moderator
1513228550
Hero Member
*
Offline Offline

Posts: 1513228550

View Profile Personal Message (Offline)

Ignore
1513228550
Reply with quote  #2

1513228550
Report to moderator
1513228550
Hero Member
*
Offline Offline

Posts: 1513228550

View Profile Personal Message (Offline)

Ignore
1513228550
Reply with quote  #2

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

Posts: 1513228550

View Profile Personal Message (Offline)

Ignore
1513228550
Reply with quote  #2

1513228550
Report to moderator
1513228550
Hero Member
*
Offline Offline

Posts: 1513228550

View Profile Personal Message (Offline)

Ignore
1513228550
Reply with quote  #2

1513228550
Report to moderator
jl2012
Legendary
*
Offline Offline

Activity: 1750


View Profile
October 12, 2013, 02:01:29 PM
 #2

Fail 1: 00:60 = 01:00

Fail 2: Just extend one more block and the first chain will win

-----------------------

To others: don't feed the troll. I stop here

Donation address: 374iXxS4BuqFHsEwwxUuH3nvJ69Y7Hqur3 (Bitcoin ONLY)
LRDGENPLYrcTRssGoZrsCT1hngaH3BVkM4 (LTC)
PGP: D3CC 1772 8600 5BB8 FF67 3294 C524 2A1A B393 6517
Come-from-Beyond
Legendary
*
Offline Offline

Activity: 1792

Newbie


View Profile
October 12, 2013, 02:10:25 PM
 #3

Fail 1: 00:60 = 01:00

Fixed, thx. But this doesn't change the result.


Fail 2: Just extend one more block and the first chain will win

What if I extended the second chain? Try to read my post instead of skimming over it.


To others: don't feed the troll. I stop here

To others: jl2012 is obviously a forum addict. He sees trolls everywhere.
pmlyon
Member
**
Offline Offline

Activity: 72


View Profile
October 12, 2013, 03:53:35 PM
 #4

I think the problem is that you are comparing two different timestamps. The first blockchain wouldn't stop mining at the 00:40 mark, so if you continue it to the 01:20 mark it will win as it should.

Author of BitSharp, a C# Bitcoin node
https://github.com/pmlyon/BitSharp/wiki
Come-from-Beyond
Legendary
*
Offline Offline

Activity: 1792

Newbie


View Profile
October 12, 2013, 04:19:07 PM
 #5

I think the problem is that you are comparing two different timestamps. The first blockchain wouldn't stop mining at the 00:40 mark, so if you continue it to the 01:20 mark it will win as it should.

Maybe... That was just an idea. Everything in our world can be modelled with the Gaussian distribution. When you try to optimize such models you usually come to "least squares".
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!