---
title: getBlockProduction
description: >-
  Returns block-production counts for validator identities in the requested slot
  range. If no range is provided, the RPC node returns counts for the current
  epoch.
url: /docs/rpc/http/getblockproduction
type: reference
hideTableOfContents: true
---

Returns block-production counts for validator identities in the requested slot
range. If no range is provided, the RPC node returns counts for the current
epoch.

<Callout type="info" title="Source">
  [`get_block_production`](https://github.com/anza-xyz/agave/blob/v3.1.8/rpc/src/rpc.rs#L3059)
</Callout>

<APIMethod>

```jsonc !!request curl
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getBlockProduction",
  "params": [
    // !hover(1:3) config
    {
      // !hover commitment
      "commitment": "finalized"
    }
  ]
}
```

```ts !!request title="Kit"
import { createSolanaRpc } from "@solana/kit";

const rpc_url = "https://api.devnet.solana.com";
const rpc = createSolanaRpc(rpc_url);

let blockProduction = await rpc.getBlockProduction().send();

console.log("block production:", blockProduction);
```

```ts !!request title="web3.js"
import { Connection, clusterApiUrl } from "@solana/web3.js";

const connection = new Connection(clusterApiUrl("devnet"), "confirmed");

let blockProduction = await connection.getBlockProduction();

console.log("block production:", blockProduction);
```

```rs !!request title="Rust"
use anyhow::Result;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;

#[tokio::main]
async fn main() -> Result<()> {
    let client = RpcClient::new_with_commitment(
        String::from("https://api.devnet.solana.com"),
        CommitmentConfig::confirmed(),
    );

    let block_production = client.get_block_production().await?;

    println!("Block production: {:#?}", block_production);

    Ok(())
}
```

### !params

#### !! config

!type object  
!optional

Configuration object

##### !! commitment

!type string  
!values processed confirmed finalized  
!default finalized

Solana RPC uses the following commitment levels:

| Value       | Description                                                                                                                                                                                                                                                                |
| ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `processed` | Return data from the highest slot this node has processed on the fork it currently considers best. This is the newest view, but it can still change if the cluster switches forks.                                                                                         |
| `confirmed` | Return data from the highest slot that at least two-thirds of active stake has directly voted to confirm. This is more stable than `processed`, but it is still a weaker guarantee than `finalized`.                                                                       |
| `finalized` | Return data from the highest slot that the cluster recognizes as finalized. In practice, this means the slot has reached maximum vote lockout in validators' vote towers and is recognized by at least two-thirds of active stake. This is the strongest commitment level. |

##### !! identity

!type string

Return only entries for this validator identity, as a base-58 encoded string.

```json title="Example"
{ "identity": "85iYT5RuzRTDgjyRa3cP8SYhM2j21fj7NhfJ3peu1DPr" }
```

##### !! range

!type object

Slot range to return block production for. If parameter not provided, defaults
to current epoch.

| Field       | Type  | Description                                                                                                                                       |
| ----------- | ----- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `firstSlot` | `u64` | First slot for which to return block-production information, inclusive.                                                                           |
| `lastSlot`  | `u64` | Last slot for which to return block-production information, inclusive. If omitted, defaults to the current slot at the selected commitment level. |

```json title="Example"
{ "firstSlot": 100, "lastSlot": 200 }
```

### !!result

```jsonc !response
{
  "jsonrpc": "2.0",
  // !hover(1:15) result
  "result": {
    // !hover(1:4) context
    "context": {
      "apiVersion": "3.1.8",
      "slot": 9887
    },
    // !hover(1:9) value
    "value": {
      "byIdentity": {
        "85iYT5RuzRTDgjyRa3cP8SYhM2j21fj7NhfJ3peu1DPr": [9888, 9886]
      },
      "range": {
        "firstSlot": 0,
        "lastSlot": 9887
      }
    }
  },
  "id": 1
}
```

!type object

RpcResponse object containing:

#### !! context

!type object

Slot and API version the node used to answer this request.

| Field        | Type     | Description                                                                     |
| ------------ | -------- | ------------------------------------------------------------------------------- |
| `slot`       | `u64`    | Slot at which the node evaluated this request.                                  |
| `apiVersion` | `string` | RPC API version reported by the node. This field may be omitted by older nodes. |

#### !! value

!type object

Block production object containing:

| Field        | Type     | Description                                                                                                                                                                 |
| ------------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `byIdentity` | `object` | Dictionary keyed by validator identity pubkey. Each value is a two-element array containing the number of leader slots assigned and the number of blocks actually produced. |
| `range`      | `object` | Slot range covered by the returned block-production data.                                                                                                                   |

**`byIdentity` entries**

| Field                 | Type             | Description                                                                  |
| --------------------- | ---------------- | ---------------------------------------------------------------------------- |
| `<validatorIdentity>` | `[usize, usize]` | Map entry keyed by a validator identity pubkey, as a base-58 encoded string. |

**`byIdentity` tuple indexes**

| Index | Type    | Description                                                               |
| ----- | ------- | ------------------------------------------------------------------------- |
| `0`   | `usize` | Number of leader slots assigned to that validator in the requested range. |
| `1`   | `usize` | Number of blocks that validator actually produced in that range.          |

**`range` fields**

| Field       | Type  | Description                                                   |
| ----------- | ----- | ------------------------------------------------------------- |
| `firstSlot` | `u64` | First slot in the returned block-production range, inclusive. |
| `lastSlot`  | `u64` | Last slot in the returned block-production range, inclusive.  |

</APIMethod>
