Closed calmrat closed 1 year ago
Below is an example with node.js and typescript:
Install polkadot/api npm package (https://www.npmjs.com/package/@polkadot/api). We use version 8.2.1
Initialise api const provider = new WsProvider("wss://rpc.mainnet.cere.network/ws"); const api = await ApiPromise.create({ provider }); await api.isReady;
Get the highest block number and log it const blockNumber = await api.derive.chain.bestNumber() console.log(blockNumber)
https://www.notion.so/cere/How-to-query-the-block-height-of-the-Cere-Mainnet-RPC-node-c7d474c0dcd24fa381662330a5ff0573
Below is an example with node.js and typescript:
Install polkadot/api npm package (https://www.npmjs.com/package/@polkadot/api). We use version 8.2.1
Initialise api const provider = new WsProvider("wss://rpc.mainnet.cere.network/ws"); const api = await ApiPromise.create({ provider }); await api.isReady;
Get the highest block number and log it const blockNumber = await api.derive.chain.bestNumber() console.log(blockNumber)