For the complete documentation index, see llms.txt. This page is also available as Markdown.

queryLedgerState_eraSummaries - Cardano

Example code for the queryLedgerState_eraSummaries JSON-RPC method. Complete guide on how to use queryLedgerState_eraSummaries JSON-RPC in GetBlock Web3 documentation.

This method returns summaries of all known eras, giving the parameters needed to convert between slots, epochs, and wall-clock time across hard forks.

Parameters

  • None

Request

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "queryLedgerState/eraSummaries",
    "id": "getblock.io"
}'
example.js
const response = await fetch(
    'https://go.getblock.io/<ACCESS-TOKEN>/',
    {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({"jsonrpc": "2.0", "method": "queryLedgerState/eraSummaries", "id": "getblock.io"})
    }
);
console.log(await response.json());
example.py
import requests

response = requests.post(
    'https://go.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={"jsonrpc": "2.0", "method": "queryLedgerState/eraSummaries", "id": "getblock.io"}
)

print(response.json())

Response

{
    "jsonrpc": "2.0",
    "method": "queryLedgerState/eraSummaries",
    "result": [
        {
            "start": {
                "time": {
                    "seconds": 0
                },
                "slot": 0,
                "epoch": 0
            },
            "end": {
                "time": {
                    "seconds": 89856000
                },
                "slot": 4492800,
                "epoch": 208
            },
            "parameters": {
                "epochLength": 21600,
                "slotLength": {
                    "milliseconds": 20000
                },
                "safeZone": 4320
            }
        }
    ],
    "id": "getblock.io"
}

Response Parameters

Field
Type
Description

start

object

Bound at which the era begins

end

object

Bound at which the era ends

parameters

object

Epoch length, slot length, and safe zone for the era

Use Cases

  • Time Conversion: Convert any slot to time across all eras

  • Scheduling: Compute future epoch and slot boundaries

  • Wallet Backends: Translate slots to dates for transaction history

  • Analytics: Normalize timestamps across hard forks

Error Handling

Error Code
Message
Description

-32602

Invalid params

A required field is missing or has the wrong type

-32000

Query unavailable

The query is not available in the current ledger era

-32603

Internal error

The node failed to answer the query

Last updated

Was this helpful?