biblepay / biblepay_legacy

BiblePay
MIT License
35 stars 34 forks source link

daily superblock time is drifting #50

Open fogoat opened 6 years ago

fogoat commented 6 years ago

As of version 1.1.5.9, the daily superblock had been staying within 1 hour in either direction. Lately though, the trend is drifting up (daily superblock is more than 24 hours). It used to be PoDC daily superblock used to arrive between 8p-9p, but this last week its been consistently arriving later and later each day. Yesterday, it arrived at midnight.

In this chart, dots closest to 0 is best. If each PoDC daily superblock time is reset at each daily superblock, this is the difference (in minutes) to the next daily superblock daily.

daily superblock difference resets each superblock day

In this chart, a level line is best. This chart doesn't "reset" on each daily superblock so you can see the cumulative drift. Around block 60k and 70k-77k the leveling off means the PoDC daily superblock was ideal (closest to 24 hours).

block time drift ideal vs actual daily superblock time

Data I used to create the charts is in a Google Sheets.

znffal made a distribution chart a few days ago as well:

znffal

biblepay commented 5 years ago

With 7 minute blocks, its hard for us to have a completely accurate clock (as our blocks are solved by luck in POBH, a POW variant for CPUs), but of course we should strive for something very accurate when taking into account the law of averages over a long period.

Over a 60 day period we have : 12300 blocks. 60 days ago we solved block : 67185 Today we solved block 79485 (exactly 12,300 later from the reference beginning block). ?date-difference("s", "08-27-2018 17:45:20","10-27-2018 00:53:06") being a difference in seconds of : 5209667 seconds (this is 60.297 days) meaning that we actually ran slow by .297 days over a 60 day period - which is a -.0055% drift.

So it appears we need to speed up our master clock by .0055% in the next mandatory to make up for this variance.

fogoat commented 5 years ago

How did you calculate a drift of -0.0055%?

Shouldn't the ideal block time between daily super blocks be 24 hours?

60.297 days tells me block time drift is 7.128 hours.

That means under ideal conditions where the daily super block is exactly 24 hours, super block is taking longer to appear precisely 7.128 hours later than the ideal.

79485, 1540601586 67185, 1535391920

(1540601586-1535391920)/60/1440 = 60.297

biblepay commented 5 years ago

First, our superblocks do not govern our target blocks per day, our target blocks per day govern the superblocks time interval.

If you study the difficulty retarget math, you will find that you have to overshoot a change by about 10% to get it to work 'relatively close' to the target- so .005% of 60.297 is very close to what we want gross, but with the overshoot its more like .0055%. I learned this from experience.

As far as 205 blocks being 1440 mins, the coin requires an int for blocks per day. So in reality, if we end up being perfect after our master clock update(s), we would end up with 7.025 minute blocks (in contrast to 7).

fogoat commented 5 years ago

Yeah, I saw the difficulty in 7 minutes as 205 blocks is 5 minutes short of a day. If you need an integer, a 6 minute block fits nicely to a day (240 blocks) but I'm sure shorter block times has significant impact on all aspects of payment.

biblepay commented 5 years ago

We have seven minute blocks - that was our launch parameter. If they end up being 7.025 they are still within the covenants of the launch because we also say 205 blocks per day.