# getBlockProduction

> Returns per-validator block production stats (slots led vs. blocks actually produced) for a slot range.

Source: https://docs.constant-k.com/rpc/http/getblockproduction/

`getBlockProduction` reports, per validator identity, how many slots they were assigned as leader and how many of those actually produced a block, over a given range (defaulting to the current epoch so far). The difference between the two numbers is skipped slots.

- Transport: HTTP, JSON-RPC 2.0 `POST` to `https://rpc-newyork.constant-k.com/?api-key=YOUR_API_KEY` (New York) or `https://rpc-frankfurt.constant-k.com/?api-key=YOUR_API_KEY` (Frankfurt) or `https://rpc-amsterdam.constant-k.com/?api-key=YOUR_API_KEY` (Amsterdam). The key also works as an `x-api-key` header.
- Category: Blocks
- Availability: All plans
- Rate limits: Free 2/s · Operator 5/s · Blade Runner 50/s · Nexus 100/s

## Parameters

`params` is a positional JSON array, in this order:

- `config` (object, optional): Optional configuration.
  - `commitment` (string, optional, one of `finalized`, `confirmed`, `processed`, default `"finalized"`): Bank state to compute production stats against.
  - `identity` (string, optional): Restrict the result to a single validator identity, base-58 encoded.
  - `range` (object, optional): Slot range to report on. Defaults to the current epoch, from its first slot through the current slot.
    - `firstSlot` (integer, required): First slot of the range, inclusive.
    - `lastSlot` (integer, optional): Last slot of the range, inclusive. Defaults to the current slot if omitted.

## Result

- `result` (object, optional): Per-identity production counts for the range, wrapped with context.
  - `context` (object, required)
    - `slot` (integer, optional)
    - `apiVersion` (string, optional)
  - `value` (object, required)
    - `byIdentity` (object, required): A dynamic map keyed by validator identity (base-58, not enumerable ahead of time), where each value is a 2-element `[leaderSlots, blocksProduced]` array of integers.
    - `range` (object, required)
      - `firstSlot` (integer, optional)
      - `lastSlot` (integer, optional)

## Example: Get production stats for a narrow 3-slot window

Request:

```bash
curl "https://rpc-newyork.constant-k.com/?api-key=YOUR_API_KEY" \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getBlockProduction",
    "params": [
      { "range": { "firstSlot": 447946416, "lastSlot": 447946418 } }
    ]
  }'
```

Response:

```json
{
  "jsonrpc": "2.0",
  "result": {
    "context": {
      "apiVersion": "4.3.0-rc.0",
      "slot": 447946861
    },
    "value": {
      "byIdentity": {
        "BDuvSzKddv74j6m1HCQzjfkipvzYUpXhcg3Jh4mUHero": [
          3,
          3
        ]
      },
      "range": {
        "firstSlot": 447946416,
        "lastSlot": 447946418
      }
    }
  },
  "id": 1
}
```

## Notes

- Calling this with no `range` scans the whole current epoch (432,000 slots) across every validator. `range` narrows the scan to a slot window, and `identity` narrows it further to one validator.
- `[leaderSlots, blocksProduced]` equal (as in the example) means a perfect no-skip record for that window; `blocksProduced` lower than `leaderSlots` means skipped slots.

