Skip to main content
TLDR:
  • Slots are scheduled intervals with a 200 ms target, and a block exists only if the slot’s leader produces one.
  • The leader of each block writes its wall-clock time into the block footer. Validators accept that time only if it is later than the parent block’s time and no more than twice the elapsed slot duration after it.
  • getBlockTime and blockTime return a block’s own time. The Clock sysvar that the block’s transactions read holds the parent block’s time.
  • Block time has whole-second resolution, so treat it as approximate and keep a margin around time-based logic.
To follow along with the RPC examples in this guide, you’ll want a Chainstack Solana RPC endpoint.

Key concepts

  • Slots — scheduled intervals in which a leader can produce a block. The target slot time is 200 ms (SIMD-0525). Not every slot produces a block. See Solana: Understanding the difference between blocks and slots.
  • Blocks — actual data structures containing transactions, state changes, and related metadata. Blocks only exist if validators successfully produce them.
  • Block time — the Unix timestamp attached to a block. Since Alpenglow, the block’s leader sets it.

How block time is set

Every block ends with a footer that carries block_producer_time_nanos, a nanosecond Unix timestamp from the leader’s clock (SIMD-0307). The leader records it when it finishes producing the block. Validators that replay the block check the footer time against the parent block’s time:
  • Lower bound — the footer time must be later than the parent block’s time.
  • Upper bound — the footer time must be no later than the parent block’s time plus twice the duration of the slots between the parent and this block.
A block whose footer time falls outside this range is rejected. After the block’s transactions run, the Clock sysvar is updated to the footer time, rounded down to whole seconds. Before Alpenglow, block time was the stake-weighted median of validators’ vote timestamps. Votes are no longer on-chain transactions, so that mechanism no longer applies.

blockTime and the Clock sysvar

The time an RPC node reports for a block and the time the block’s transactions read are two different values: To reproduce the clock a historical transaction saw — for example, when you re-simulate a deadline check — take the parent slot from getBlock (parentSlot) and use that slot’s block time, not the block time of the transaction’s own block. Block time has whole-second resolution and slots are shorter than a second, so consecutive blocks often share the same blockTime.

Off-chain time retrieval via JSON-RPC

Get block time

Retrieve the Unix timestamp for a given slot:
Replace SLOT_NUMBER with the desired slot and CHAINSTACK_SOLANA_URL with your Solana node endpoint.

Get detailed block information

Retrieve block details including block time, block hash, and the parent slot:
Replace SLOT_NUMBER and CHAINSTACK_SOLANA_URL with your Solana node endpoint.

Get latest slot

Check the latest slot number:

Get latest block height

Retrieve the latest block height (actual blocks produced):

On-chain time: Clock sysvar

Solana programs read the current time from the Clock sysvar:
  • unix_timestamp — a whole-second timestamp. During transaction execution, it holds the parent block’s time, so it estimates when the parent block ended rather than when the current block began. See Clock sysvar in the Anza documentation.
  • slot — the current slot.
Programs rely on this timestamp for logic like auctions or expirations.

Best practices for time-sensitive logic

  • Use on-chain time — use the on-chain timestamp (Clock::get()?.unix_timestamp) for on-chain logic. Do not depend on client-side or local times.
  • Keep a margin — the timestamp has whole-second resolution and trails the current block, so leave at least a few seconds of buffer around deadlines.
  • Blocks vs. slots — transaction expiration is based on blocks, not slots: a recent blockhash stays valid for 150 blocks. Skipped slots don’t count toward that window.

Common pitfalls

And don’t forget to code your getBlock calls efficiently — see Solana: optimize your getBlock performance.

Ake

Ake Director of Developer Experience @ Chainstack
Talk to me all things Web3
20 years in technology | 8+ years in Web3 full time years experience
Last modified on November 9, 2026