MultiversX Tracker is Live!

Is timestamping needed for anything except difficulty adjustment

Bitcoin Stack Exchange

Bitcoin News / Bitcoin Stack Exchange 197 Views

It seems to me that PoW overwrites whatever timestamps there may be, and in effect determines what "time" is for the blockchain.

I think this is your confusion: arguably, timestamping is part of PoW. The only timestamps that exist in the Bitcoin protocol are those included in block headers by miners, and committed to by the proof of work. These provide the (very rough) timing information blocks carry. Transactions or blocks don't contain any timestamps besides these.

In more detail, every block consists of a header and list of transactions. That header contains the hash of the (Merkle root of) transactions, the hash of the previous block, a timestamp, a version number, a nonce, and the difficulty. There are two requirements for that timestamp to be valid:

  • The timestamp must be higher than the median of the 11 immediate ancestors of the block (violating this rule makes the block permanently invalid). Note however that this does mean that blocks can have a timestamp lower than their parent.
  • The timestamp must be no more than 2 hours in the future (violating this rule makes the block only temporarily unacceptable, but not invalid, because waiting some time will change it).

But, importantly, these rules are the only requirements, and miners are free to pick any timestamp between the lower bound set by the first rule, and the upper bound set by the second one. In practice, miners choose times that tend to be close to or at least around the current real-world time, because that maximizes the acceptability of the block and thus income. Together however, this only really means that the timestamps in blocks have an accuracy of roughly 1 hour.

That timestamp is used for two purposes:

  • The block difficulty adjustment rule uses the timestamps of the first and last block within every 2016-block retarget window to determine what difficulty factor to apply. If miners would set timestamps artificially low (permitted by the first rule above), they'd cut their own flesh, as that would drive up the block difficulty, reducing their income. (this rule isn't perfect however and could be exploited; look up the timewarp attack for more details).
  • Transactions can have a timelock that determines when the earliest time is that they can be included in a block. To make sure all nodes agree about which block that is, transaction timelocks are compared with the block's timestamp, and not with nodes' own local clocks.

Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments