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

system_chain - Kusama

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

Returns the name of the chain the node is connected to (for example, Kusama). Used to confirm the node is serving the expected network.

Available over both the JSON-RPC (HTTP) and WebSocket interfaces.

Parameters

This method takes no parameters; send an empty params array.

Request

curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "method": "system_chain",
    "params": []
}'
example.js
const axios = require('axios');

const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    id: 'getblock.io',
    method: 'system_chain',
    params: []
}, { headers: { 'Content-Type': 'application/json' } });

console.log(response.data.result);
example.py
import requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'id': 'getblock.io',
        'method': 'system_chain',
        'params': []
    }
)

print(response.json())

Response

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "Kusama"
}

Response Fields

Field
Type
Description

result

string

Human-readable chain name

Use Cases

  • Network Guard: Confirm the node serves Kusama, not another Substrate chain

  • Diagnostics: Report the chain name in tooling

  • Config: Key configuration off the chain name

Error Handling

Error
Message
Description

-32603 / Internal error

Internal error

The node failed to return the chain name

403 / RBAC: access denied

Access denied

The GetBlock access token is missing or incorrect

Last updated

Was this helpful?