circle-infogetBlockProduction

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

The getBlockProduction RPC method provides detailed insights into block production statistics within a specific slot range or the current epoch. It is particularly useful for monitoring validator performance, analyzing network participation, and detecting missed leader slots.


Common Use Cases

  • Monitor Validator Performance Track how many leader slots were assigned and how many blocks a validator actually produced.

  • Analyze Epoch-Wide Participation View block production data across all validators within the current or a historical epoch.

  • Detect Missed Slots Identify whether a validator missed their assigned slots, helping measure uptime or reliability.

  • Assess Network Health Evaluate overall block production efficiency as part of broader network monitoring.


Request Parameters

You can call getBlockProduction with an optional configuration object:

  • commitment (string, optional): Determines the commitment level to use. Defaults to the node’s configured level.

  • range (object, optional): Specifies the slot range to examine.

    • firstSlot (u64, required if no identity): Start slot (inclusive).

    • lastSlot (u64, optional): End slot (inclusive). If omitted, data will be returned up to the current slot.

  • identity (string, optional): The base58-encoded public key of a validator. If specified, returns data only for that validator. ⚠️ Either identity or range.firstSlot must be provided.


Response Structure

  • context (object):

    • slot: The slot at which the query was evaluated.

  • value (object):

    • byIdentity: An object mapping each validator’s identity (public key) to:

      • leaderSlots: Number of slots assigned.

      • blocksProduced: Number of blocks successfully produced.

    • range:

      • firstSlot: Start of the queried range.

      • lastSlot: End of the queried range.

Examples

1. Get Block Production for Current Epoch (All Validators)

  1. Get Block Production for a Specific Validator (Current Epoch)

  1. Get Block Production for a Validator in a Slot Range

Code Examples

Example Response

This guide should give you a solid understanding of how to use the getBlockProduction RPC method to monitor and analyze validator and network block production on Solana.

Developer Tips

  • Epoch Boundaries Matter If querying by identity only, results are scoped to the current epoch up to the latest processed slot. For past epochs, use range.firstSlot and range.lastSlot.

  • Data Retention Depends on RPC Node Older slot ranges may not be available on all providers. CoinVera’s node infrastructure may retain more recent data.

  • Essential for Validator Monitoring This RPC is ideal for building dashboards that display block production stats, uptime, and slot efficiency metrics.

  • Enhance with getLeaderSchedule Pair with getLeaderSchedule to get a detailed view of when each validator was expected to produce blocks.

  • Large Data Sets Warning If querying without specifying an identity, and over a wide slot range, expect large responses. Limit the range or filter by identity for efficient processing.

Last updated