chain_get_era_summary

Casper RPC

How to use it

// yarn add @tatumio/tatum

import { TatumSDK, Casper, Network } from '@tatumio/tatum'

const tatum = await TatumSDK.init<Casper>({ network: Network.CASPER })

const blockHash = 'a4b607420ae737f9cd474af73c9f5e908f61edd2e57d48371d15835127b46aaf' // Replace with actual block hash
const blockHeight = 3229836 // Replace with actual block height

const resultByHash = await tatum.rpc.chainGetEraSummary({ hash: blockHash })
const resultByHeight = await tatum.rpc.chainGetEraSummary({ height: blockHeight })

await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs

Request Example

curl --location 'https://api.tatum.io/v3/blockchain/node/casper-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
    "jsonrpc":"2.0",
    "method":"chain_get_era_summary",
    "params":[
        {
            "Hash":"a4b607420ae737f9cd474af73c9f5e908f61edd2e57d48371d15835127b46aaf"
        }
    ],
    "id":1
}'

Overview

chain_get_era_summary is an RPC method on the Casper blockchain that retrieves the summary of an era at a given block hash or height. This includes details such as the era's ID, state root hash, and seigniorage allocations.

Parameters

The chain_get_era_summary method accepts the following parameters:

  • hash: The hash of the block to retrieve.
    Or
  • height Identify and retrieve the Block with its height.

Return Object

The chain_get_era_summary method returns an object with the following fields:

  • api_version: The API version. Example: "1.5.6"
  • era_summary: An object containing the era summary details.
    • block_hash: The block hash. Example: "9bfa58709058935882a095ca6adf844b72a2ddf0f49b8575ef1ceda987452fb8"
    • era_id: The ID of the era. Example: 1
    • stored_value: An object containing the stored value.
      • EraInfo: An object with seigniorage allocations.
        • seigniorage_allocations: An array of objects with delegator and validator details.
          • Delegator: Contains delegator_public_key, validator_public_key, and amount.
          • Validator: Contains validator_public_key and amount.
    • state_root_hash: The state root hash. Example: "918abd1973171867e03c1e6e56fd7dd9da35c92461784f9a15c0df23e437d850"
    • merkle_proof: A proof related to the era summary.

Response

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "api_version": "1.5.6",
    "era_summary": {
      "block_hash": "9bfa58709058935882a095ca6adf844b72a2ddf0f49b8575ef1ceda987452fb8",
      "era_id": 1,
      "stored_value": {
        "EraInfo": {
          "seigniorage_allocations": [
            {
              "Delegator": {
                "delegator_public_key": "01c08939bf1ecd1139448d435989a761c975466d30b96c2dd74e9d23c7b12bc9ff",
                "validator_public_key": "01039c258651e04597d786142d9749922245cf44b6cc0c93c58bd6c1783ac3be9b",
                "amount": "53472520551166781393617756"
              }
            },
            ...
          ]
        }
      },
      "state_root_hash": "918abd1973171867e03c1e6e56fd7dd9da35c92461784f9a15c0df23e437d850",
      "merkle_proof": "010000000e0000000000000000000000000000000000000000000000000000000000000000..."
    }
  }
}

Notes

  • This method returns the era summary of a specific block from the network.
  • Ensure to replace the block hash or height with the actual block identifier you intend to query.

For more detailed information, refer to the official Casper documentation