On Sat, Oct 12, 2019 at 6:56 PM Joachim Strömbergson <joachimstr@protonmail.com> wrote:
I like the backwards syncing idea. First you provide proof of your best block height via coinbase, then sync backwards. It solves lots of related problems. You know how much you can expect from the given peer.

It shows you which nodes are on the same chain too.

If you have 8 peers and you ask the 8 of them for their 8 best, then they should all agree on most of them.

You can then ask each of the 8 to start sending you headers backwards from one of the 8 seeds.

They will all roughly split the chain into 8 equal pieces, though the split will be based on work rather than header height.

If there is disagreement, you can give priority to the node(s) with the lowest headers until they have completed their download.

It requires a network protocol change to allow reverse block downloads though (and messages to indicate lowest headers etc.)

On different note, one of the problems that I haven't seen mentioned here yet is the timewarp attack. It is relevant to some of the proposed solutions. It should be possible, IIRC, for a malicious node to generate much longer chain with superslow timestamp increase (~5 blocks in 1 second) without increasing difficulty (i.e. staying at min. diff.). This could produce chain that is ~2500 times longer than main chain without having multiple branches.

That is a good point.  It answers my question about formula for maximum number of blocks.

5 * 60 * 60 * 24 * 365 = 157,680,000

That's around 150 million blocks per year at that rate.

I assume the 5 per second limit is that it is greater that the median of the last 11 rather than greater or equal?

The timewarp bug can be fixed by a basic soft fork.  You just need to limit the maximum difference between the timestamp for the first header in a period and the last header in the previous period.

An alternative would be to soft fork in a maximum block rate.  In addition to the current rules, you could limit it to a maximum of 1 block every 2 mins.  That rule shouldn't activate normally.

   block.height <= (block.timestamp - genesis.timestamp) / (2 mins)

It could have some weird incentives if it actually activated though.  Miners would have to shutdown mining if they were finding blocks to fast.