Skip to content

getBlocksByEpoch

Get the block hashes in the specified epoch.

Usage

example.ts
import { publicClient } from "./client";

const hashes = await publicClient.getBlocksByEpoch();

Returns

Hash[]

Parameters

epochTag (optional)

  • Type latest_mined|latest_state|latest_confirmed|latest_checkpoint | earliest
  • Defaut latest_state
const hashes = await publicClient.getBlocksByEpoch({
  epochTag: "latest_state", 
});

epochNumber (optional)

  • Type bigint
const hashes = await publicClient.getBlocksByEpoch({
  epochNumber: 1n, 
});

JSON-RPC Method

cfx_getBlocksByEpoch