Skip to main content

Parameters

number
required
The slot to get the block time for

Response

number | null
Unix timestamp of when the block was produced, or null if the block is not available

Code Examples

Basic Request

Using web3.js

Notes

  1. Returns the Unix timestamp when the block was produced
  2. Returns null if the block is not available
  3. The timestamp is in seconds since Unix epoch
  4. Block times are estimates and may vary between nodes
  5. Older blocks may not have timestamps available

Best Practices

  1. Handle null responses appropriately
  2. Convert Unix timestamps to Date objects for display
  3. Consider timezone differences when displaying times
  4. Cache results when appropriate to reduce RPC load
  5. Use this method in conjunction with other block methods

Common Errors

Use Cases

  1. Block Time Analysis
  2. Block Time Tracking
  3. Block Production Rate