Ethereum
Bereit, das in der Produktion aufzurufen?
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
Ethereum
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
The timestamp field on an Ethereum block is the closest thing a smart contract has to a clock. Vesting schedules, auction deadlines, staking lockups, and TWAP oracles all lean on it, and off-chain indexers use it to put a wall-clock time on events. The catch is that it's not a precise clock at all — it's a value the block proposer sets, loosely constrained by the protocol, advancing in steps tied to Ethereum's 12-second slots. Treat it like an exact, trustworthy timestamp and you open the door to subtle bugs and, in some designs, manipulation.
This guide is for smart contract and dApp developers who need time-aware logic on chain 1. It covers how timestamps are actually set, what guarantees you do and don't get, the bounds within which a validator can nudge a timestamp, and the patterns that keep time-sensitive code safe — including when to reach for block numbers instead.
block.timestamp. Never use the timestamp as a source of entropy.block.timestamp, since a proposer can choose it.number, which increments by exactly one per slot and can't be manipulated, instead of comparing timestamps that may be only seconds apart.