kindelia / Kindelia

An efficient, secure cryptocomputer
https://kindelia.org/
603 stars 39 forks source link

discussion: Should Kindelia use a Median-Time-Past rule? #266

Open dan-da opened 1 year ago

dan-da commented 1 year ago

Node::add_block() is presently validating that timestamp of each block is greater than timestamp of parent block. This prevents any out-of-time-order blocks from occurring, which seems good, however it will lead to otherwise valid blocks from being included, and might lead to a lot of wasted cycles for some miners.

I have not looked deeply into this. There might be other ramifications, even possible attacks.

Bitcoin uses these rules:

  1. A node will not accept a block whose timestamp is more than two hours in the future.
  2. A node will not accept a block unless it has a timestamp greater than the median of the previous 11 blocks. In Bitcoin, we call this Median-Time-Past (MTP).

Apparently with Bitcoin blockchain, it is a common occurrence that miners have unsynced clocks and out-of-time-order blocks are created. quote:

it happens a ton! I was just looking at the last several weeks of block header data, there are a couple hundred blocks where timestamps are out of order - but only by a couple minutes, usually.

Clearly, if the kindelia rule were used, it would not "happen a ton", in fact it would never happen. Maybe this would only have the effect that all miners are more diligent about keeping their clocks synced using eg ntp. Or maybe it would mean some miners become unprofitable and thus choose not to mine anymore. If the latter, this is harmful to network security.

I am unsure of the right answer. I am just bringing this up for discussion.

It is probably worthwhile to review what other blockchain systems, in particular smart contract platforms have done.