In the documentation getChainProperties(https://polkadot.js.org/docs/api/examples/promise/chain-info/) is mentioned for getting the properties for a blockchain, but it contains very little amount of information.

How could I query the chainspec of a blockchain from an RPC? I am specifically interested in the name and para_id(if a parachain) fields.

2 Answers 2


I did not find a specific way to query the chainspec, but using a different approach I am able to get the parachain id and the name of the blockchain.

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

/* snip */

// Create an API
api = await ApiPromise.create({ provider: wsProvider, noInitWarn: true });

// Get the blockchain name:
const name = await api.rpc.system.chain();

// Get the parachain id:
const parachainId = await api.query.parachainInfo.parachainId();
  • 1
    is this answer good enough for the original question? if you think so, please set it as the confirmed answer. Also, for completenesses, here you have all the available system RPC methods for Polkadot Relay chain: polkadot.js.org/docs/polkadot/rpc#system
    – Iker
    Jul 24, 2023 at 10:07

The RPC call sync_state => genSyncSpec. Unfortunately atm only available for the relay chains it seems (ref).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.