Skip to main content

system_name - JSON-RPC Method

Description#

Returns the node implementation name for the connected Moonbase Alpha node. This method identifies the specific software implementation running the node, such as "Moonbeam", "moonbeam-node", or other client implementations. The node name is essential for compatibility verification, debugging, and ensuring your application works correctly with the expected node implementation.

Parameters#

This method does not require any parameters.

Returns#

FieldTypeDescription
resultstringNode implementation name (e.g., "moonbeam", "moonbeam-node")

Use Cases#

  1. Implementation Verification: Confirm you're connected to the expected node implementation
  2. Compatibility Checks: Validate node software before using implementation-specific features
  3. Debugging Support: Log node implementation details when troubleshooting issues
  4. Version Management: Track which node implementations are running in your infrastructure
  5. Network Diagnostics: Identify node software in multi-node deployments
  6. Monitoring Dashboards: Display node implementation information in operational dashboards

Request Example#

curl -X POST https://api-moonbase-alpha.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"system_name","params":[]}'

Response Example#

{
"jsonrpc": "2.0",
"result": "moonbeam",
"id": 1
}

Code Examples#

JavaScript (polkadot.js)#

import { ApiPromise, WsProvider } from '@polkadot/api';

const api = await ApiPromise.create({
provider: new WsProvider('wss://api-moonbase-alpha.n.dwellir.com/YOUR_API_KEY')
});
const nodeName = await api.rpc.system.name();
console.log(`Node implementation: ${nodeName.toString()}`);

Python#

import requests
import json

def get_node_name():
url = "https://api-moonbase-alpha.n.dwellir.com/YOUR_API_KEY"
payload = {
"jsonrpc": "2.0",
"method": "system_name",
"params": [],
"id": 1
}
response = requests.post(url, json=payload)
return response.json()["result"]

node_name = get_node_name()
print(f"Connected to {node_name} node")

Node.js (fetch)#

async function getNodeInfo() {
const response = await fetch('https://api-moonbase-alpha.n.dwellir.com/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'system_name',
params: [],
id: 1
})
});
const data = await response.json();
return data.result;
}

const nodeName = await getNodeInfo();
console.log(`Node implementation: ${nodeName}`);

Best Practices#

  • Combine with system_version to get complete node identification
  • Cache node name during application initialization to reduce RPC calls
  • Use node name in error reports and support tickets for better diagnostics
  • Validate expected node implementation in production environments
  • Include node name in application logs for operational visibility