bitcoin-dev

Year 2038 problem and year 2106 chain halting

Year 2038 problem and year 2106 chain halting

Original Postby yanmaani at cock.li

Posted on: October 17, 2021 15:14 UTC

The context discusses the issue of timestamp overflow in bitcoin transactions due to the limitation of a 32-bit timestamp.

The proposed solution suggests introducing a new variable 'k' representing the most significant 32 bits of a 64-bit timestamp, to be stored in all cases where time is used. However, there is a concern that skipping 'k' could cause problems related to OP_CHECKLOCKTIMEVERIFY or nLockTime. Therefore, it is recommended to add the 'k' value to the coinbase transaction and combine the lower bits from the block header and higher bits from the coinbase transaction. Moreover, adding the 'k' value to the transaction nLockTime field is necessary because, after reaching 0x0000000100000000, all off-chain transactions with timelocks around 0x00000000ffffffff will be additionally timelocked for the next N years. The same is needed for each OP_CHECKLOCKTIMEVERIFY. It is suggested to push high 32 bits before the currently used value, assuming zero if there is only some 32-bit value. Although this proposal is a hardfork, it kicks in way into the future, and anything can be done as long as it doesn't change anything now. In very special cases, extra logic for locktime may be required, but worst-case, block time locking in the years around the switch or softfork in 64-bit locking can be used. The proposed solution solves the problem of chain halting, and after the switchover, everything would be back to normal.