Docs

system_chain - Bifrost RPC Method

Get the chain name on Bifrost. Essential for network identification, multi-chain applications, and verifying the correct network connection.

Returns the chain name of the Bifrost network. This identifies the specific chain or network the node is connected to (e.g., "Polkadot", "Kusama", "Westend").

Why Bifrost? Build on Polkadot's largest liquid staking appchain with 60% DOT LST market share and $125M+ TVL with first LST governance on OpenGov, 60% DOT market share, Hyperbridge ETH integration, and 500K DOT treasury support.

When to Use This Method

system_chain is essential for liquid staking developers, DeFi builders, and teams requiring cross-chain yield solutions:

  • Network Verification -- Confirm your application is connected to the correct Bifrost network before processing transactions
  • Multi-Chain Applications -- Dynamically identify which Substrate chain you are interacting with in cross-chain or multi-network dApps
  • UI Display -- Show the connected network name in wallet interfaces and dashboards for omnichain liquid staking (vDOT, vKSM, vGLMR, vMOVR, vASTR), cross-chain vToken governance, and DOT/ETH liquidity bridging
  • Configuration Validation -- Verify endpoint configuration matches the expected chain during deployment

Code Examples

Common Use Cases

1. Network Connection Verification

Validate that your application connects to the correct chain before processing any transactions:

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

async function connectAndVerify(endpoint, expectedChain) {
  const provider = new WsProvider(endpoint);
  const api = await ApiPromise.create({ provider });

  const chain = await api.rpc.system.chain();
  const chainName = chain.toString();

  if (chainName !== expectedChain) {
    await api.disconnect();
    throw new Error(
      `Expected "${expectedChain}" but connected to "${chainName}"`
    );
  }

  console.log(`Verified connection to ${chainName}`);
  return api;
}

// Usage
const api = await connectAndVerify('https://api-bifrost-polkadot.n.dwellir.com/YOUR_API_KEY', 'Bifrost');

2. Multi-Chain Router

Route operations based on detected chain identity:

JavaScript
async function getChainConfig(api) {
  const [chain, properties] = await Promise.all([
    api.rpc.system.chain(),
    api.rpc.system.properties()
  ]);

  const chainName = chain.toString();
  const configs = {
    Polkadot: { explorer: 'https://polkadot.subscan.io', confirmations: 1 },
    Kusama: { explorer: 'https://kusama.subscan.io', confirmations: 1 },
  };

  const config = configs[chainName] || { explorer: null, confirmations: 1 };

  return {
    name: chainName,
    tokenSymbol: properties.tokenSymbol.toString(),
    tokenDecimals: properties.tokenDecimals.toJSON(),
    ...config
  };
}

3. Health Check with Chain Identity

Include chain identity in health-check monitoring:

JavaScript
async function healthCheck(api) {
  const [chain, name, version] = await Promise.all([
    api.rpc.system.chain(),
    api.rpc.system.name(),
    api.rpc.system.version()
  ]);

  return {
    status: 'healthy',
    chain: chain.toString(),
    nodeImplementation: name.toString(),
    nodeVersion: version.toString(),
    timestamp: new Date().toISOString()
  };
}

Error Handling

Common errors and solutions:

Error CodeDescriptionSolution
-32603Internal errorNode may be starting up -- retry after delay
-32005Rate limit exceededReduce request frequency or implement client-side rate limiting
Connection refusedNode unreachableVerify the RPC endpoint URL and that the node is running