A contract can reference the currently being mined contract's timestamp. This means that changing the timestamp of an in-progress to be mined block requires executing all contracts referencing that timestamp. How exactly does Ethereum avoid miners being incentivized to keep old (inaccurate) timestamps within their blocks due to this? Or am I misunderstanding how contracts and blocks tend to interact?
-
Probably related enough to be a duplicate? ethereum.stackexchange.com/questions/413/…– Richard HorrocksCommented Oct 24, 2016 at 16:03
-
@RichardHorrocks I've read that, but it doesn't explain at all how miners would not benefit from leaving their block time as stale (other than the various constraints, such as can't be earlier than last block)– EarlzCommented Oct 24, 2016 at 16:12
-
Related: ethereum.stackexchange.com/questions/5927/…– eth ♦Commented Oct 24, 2016 at 17:37
1 Answer
The timestamps are saved into the blockheader. They don't get updated but they are part of the consensus and can't get altered after mined.
We can't consider the timestamp exact at all, but the information you get out of the timestamp is not super interesting. "When exactly was this block mined?" A question with limited practical use, given that they must fall into a limited interval.
Important is that the sequence of blocks is not messed up and that the block height is correlated with a certain time so that on average we have linear block times.
-
My specific question is about contracts making use of that block time in a block that's still not mined. What incentive is there for a miner to update the timestamp from when they first start trying to mine a block, since otherwise changing the timestamp will require reevaluating at least some contracts that make use of that timestamp– EarlzCommented Oct 24, 2016 at 18:23
-
As said, there is no incentive, there is a decentive: the hash would not be valid anymore and all the mining was for nothing. Updating the timestamp: it will not happen. Commented Oct 24, 2016 at 18:29
-
I guess for the short block times with ethereum, it's not as much of a problem compared to other blockchains too though..– EarlzCommented Oct 25, 2016 at 18:16