Would it be possible for the timestamps on the final block in consecutive periods to compound the error rather than cancelling each other out?
i.e. if a someone made a concerted effort of falsifying the timestamp on the last block in each period could they stretch the average time by a meaningful amount?
First of all, they'd have to have a LOT of hash power to be sure that they get the final block of each difficulty period. The odds of getting that block are the same as the odds of getting any other block. In other words, if you had 10% of the total global hash power, you would on average solve only 1 out of every 10 last blocks of difficulty periods. If you had 25% of the total global hash power, you would on average solve only 1 out of every 4 last blocks of difficulty periods.
To have enough hash power to consistently solve the last block of a difficulty period, you'd have to have more hash power than the rest of the world combined. If you have that, then you already have enough to pull off a 50% attack, and this "last block of difficulty period" is no longer interesting.
Now, even if you somehow were lucky enough to get the last block of 10 difficulty periods in a row, the best you could do would be to create an oscillation between blocks that are a few seconds too fast and blocks that are a few seconds too slow.
Here's an example where the "attacker" gets the last block in the period 4 periods in a row and always adds 2 hours to his timestamp:
Period 1 => Start timestamp accurate, end timestamp 120 minutes late. (new difficulty results in blocks occurring
3.6 seconds sooner)
Period 2 => Start timestamp 120 minutes late, end timestamp 120 minutes late. (notice that you lose 120 minutes off the beginning of the period, but gain those same 120 minutes at the end of the period, therefore the total period is still accurate. As such new difficulty results in blocks occurring with an
average 10 minute interval.)
Period 3 => Start timestamp 120 minutes late, end timestamp 120 minutes late. (notice that you lose 120 minutes off the beginning of the period, but gain those same 120 minutes at the end of the period, therefore the total period is still accurate. As such new difficulty results in blocks occurring with an
average 10 minute interval.)
Period 4 => Start timestamp 120 minutes late, end timestamp 120 minutes late. (notice that you lose 120 minutes off the beginning of the period, but gain those same 120 minutes at the end of the period, therefore the total period is still accurate. As such new difficulty results in blocks occurring with an
average 10 minute interval.)
Period 5 => Start timestamp 120 minutes late, end timestamp accurate. (new difficulty results in blocks occurring
3.6 seconds later)
Here's what happens if he oscillates instead:
Period 1 => Start timestamp accurate, end timestamp 120 minutes late. (new difficulty results in blocks occurring
3.6 seconds sooner)
Period 2 => Start timestamp 120 minutes late, end timestamp 60 minutes early. (notice that you lose 120 minutes off the beginning of the period, and lose another 60 minutes at the end of the period, therefore the total period is off by 3 hours. As such new difficulty results in blocks occurring about
5.4 seconds later than they otherwise would.)
Period 3 => Start timestamp 60 minutes early, end timestamp 120 minutes late. (notice that you gain 60 minutes off the beginning of the period, and gain another 120 minutes at the end of the period, therefore the total period is off by 3 hours. As such new difficulty results in blocks occurring about
5.4 seconds sooner than they otherwise would.)
Period 4 => Start timestamp 120 minutes late, end timestamp 60 minutes early. (notice that you lose 120 minutes off the beginning of the period, and lose another 60 minutes at the end of the period, therefore the total period is off by 3 hours. As such new difficulty results in blocks occurring about
5.4 seconds later than they otherwise would.)
Period 5 => Start timestamp 60 minutes early, end timestamp accurate. (new difficulty results in blocks occurring about
1.8 seconds earlier)