circle-infogetBlockTime

Learn getBlockTime use cases, code examples, request parameters, response structure, and tips.

The getBlockTime RPC method returns the estimated Unix timestamp for when a given block (identified by its slot number) was produced. The timestamp is expressed as seconds since the Unix epoch. This method is essential for aligning on-chain events with real-world time.


✅ Common Use Cases

  • Timestamping On-Chain Events Determine the approximate real-world time a block was created to timestamp program executions, transactions, or events.

  • Analyze Block Intervals Calculate time differences between slots to examine validator behavior, slot scheduling, or block spacing.

  • Correlate Off-Chain Events Match external data (e.g. trades, system logs) with blockchain activity using slot-to-time mapping.


🛠 Request Parameters

  • slot (u64, required): The slot number for which to retrieve the estimated production time.


📦 Response Structure

The result field will return:

  • timestamp (i64): The block’s estimated Unix timestamp (in seconds).

  • null: Returned if the timestamp is unavailable—typically because:

    • The block is too old and the data has been pruned.

    • The slot was skipped and has no associated block or timestamp.

💡 Example

Get Estimated Production Time for a Specific Slot

Code Examples

Example Response

📌 Replace 355104000 with a recent, confirmed slot number from your target cluster (e.g., Mainnet or Devnet).

🧠 Developer Tips

  • Timestamp Availability May Vary Older or skipped slots may return null. This is due to pruning or the absence of block production.

  • Estimated, Not Exact The returned timestamp is stake-weighted, based on vote timestamps. It’s generally accurate but not cryptographically guaranteed.

  • Node Variability Timestamps may differ slightly between RPC providers depending on validator reports and ledger history. For recent blocks, confirmation delays may affect availability.

Last updated