---
title: getEpochInfo
description: >-
  Returns the current epoch position and counters the node sees at the requested
  commitment.
url: /docs/rpc/http/getepochinfo
type: reference
hideTableOfContents: true
---

Returns the current epoch position and counters the node sees at the requested
commitment.

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

<APIMethod>

```jsonc !!request curl
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getEpochInfo",
  "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 epochInfo = await rpc.getEpochInfo().send();

console.log(epochInfo);
```

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

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

let epochInfo = await connection.getEpochInfo();

console.log(epochInfo);
```

```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 epoch_info = client.get_epoch_info().await?;

    println!("{:#?}", epoch_info);

    Ok(())
}
```

### !params

#### !! config

!type object  
!optional

Configuration object containing the following fields:

##### !! 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. |

##### !! minContextSlot

!type number

The minimum slot that the request can be evaluated at.

```json title="Example"
{ "minContextSlot": 341197000 }
```

### !!result

```jsonc !response
{
  "jsonrpc": "2.0",
  // !hover(1:8) result
  "result": {
    // !hover absoluteSlot
    "absoluteSlot": 166598,
    // !hover blockHeight
    "blockHeight": 166500,
    // !hover epoch
    "epoch": 27,
    // !hover slotIndex
    "slotIndex": 2790,
    // !hover slotsInEpoch
    "slotsInEpoch": 8192,
    // !hover transactionCount
    "transactionCount": 22661093
  },
  "id": 1
}
```

!type object

Epoch info response object containing:

##### !! absoluteSlot

!type u64

Absolute slot the node used to answer this request.

##### !! blockHeight

!type u64

Block height the node used to answer this request.

##### !! epoch

!type u64

Epoch that contains the slot used for this request.

##### !! slotIndex

!type u64

Slot index within the current epoch.

##### !! slotsInEpoch

!type u64

Total number of slots in the current epoch.

##### !! transactionCount

!type u64 | null

Total number of transactions since genesis, if available.

</APIMethod>
