Base
Ready to call this in production?
Free tier covers personal projects. Pay-as-you-go scales without a card.
Base
Free tier covers personal projects. Pay-as-you-go scales without a card.
Many Base contracts lean on block.timestamp — vesting unlocks, staking rewards, auction deadlines, time-locked withdrawals — and off-chain services use block timestamps to order events and reconstruct history. But a timestamp on Base is a value the sequencer assigns, not a reading from a trusted clock, so treating it as precise wall-clock time leads to subtle bugs and, occasionally, exploitable contracts. This guide is for smart contract and backend developers building on Base: it covers how timestamps are set on this OP Stack rollup, what accuracy you can and cannot count on at roughly 2-second blocks, how much a sequencer can nudge them, and the patterns that keep time-based logic safe.
block.timestamp or the getBlockTimestamp helper.block.timestamp against an off-chain Date.now() or against timestamps from another chain.block.timestamp as approximate. Never compare it for equality (== someTime) or build logic that breaks if it is off by a few seconds; use inequalities with margin instead. Crucially, never derive randomness or high-value secrets from the timestamp — it is partly under the sequencer's control.