system_chain - JSON-RPC Method
Description
Returns the name of the chain the node is connected to. This JSON-RPC method is useful for identifying which Acala network (mainnet or custom chain) the node is operating on.
Parameters
This method does not require any parameters.
Returns
Field | Type | Description |
---|---|---|
result | string | The name of the chain |
Request Example
{
"jsonrpc": "2.0",
"method": "system_chain",
"params": [],
"id": 1
}
Response Example
{
"jsonrpc": "2.0",
"result": "Acala",
"id": 1
}
Code Examples
- cURL
- Python
- JavaScript
curl https://api-acala.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "system_chain",
"params": [],
"id": 1
}'
import requests
import json
def get_chain_name():
url = "https://api-acala.n.dwellir.com/YOUR_API_KEY"
headers = {
"Content-Type": "application/json"
}
payload = {
"jsonrpc": "2.0",
"method": "system_chain",
"params": [],
"id": 1
}
response = requests.post(url, headers=headers, data=json.dumps(payload))
data = response.json()
if "error" in data:
raise Exception(f"RPC Error: {data['error']}")
return data["result"]
chain = get_chain_name()
print(f"Connected to: {chain}")
const getChainName = async () => {
const response = await fetch('https://api-acala.n.dwellir.com/YOUR_API_KEY', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'system_chain',
params: [],
id: 1
})
});
const data = await response.json();
return data.result;
};
const chain = await getChainName();
console.log(`Connected to: ${chain}`);
Related Methods
state_getRuntimeVersion
- Get runtime versionsystem_health
- Get node healthrpc_methods
- List available methodsstate_getMetadata
- Get runtime metadata