In this section we'll learn how to get the some basic network information using polkadot.js API
Check the network information using Polkadot API
// Import the Polkadot APIimport { ApiPromise, WsProvider } from'@polkadot/api';asyncfunctionconnectAndFetchChainInfo() {// Create a connection to the Polkadot network via websocketconstpolkadotWsProvider=newWsProvider('wss://rpc.polkadot.io');// Create a new instance of the Polkadot APIconstpolkadotApi=awaitApiPromise.create({ provider: polkadotWsProvider });// Retrieve information about the Polkadot chainconstpolkadotChainInfo=awaitpolkadotApi.registry.getChainProperties();console.log(polkadotChainInfo);// For Polkadot, this would print// {ss58Format: 0, tokenDecimals: [10], tokenSymbol: [DOT]}}connectAndFetchChainInfo().catch(console.error).finally(() =>process.exit());