Cerebellum-Network / contribute

Cere contributor community, discussion forums, and more
Apache License 2.0
0 stars 0 forks source link

FAQ: How to get blockheight of Cere Network? #31

Closed calmrat closed 1 year ago

calmrat commented 1 year ago

Below is an example with node.js and typescript:

  1. Install polkadot/api npm package (https://www.npmjs.com/package/@polkadot/api). We use version 8.2.1

  2. Initialise api const provider = new WsProvider("wss://rpc.mainnet.cere.network/ws"); const api = await ApiPromise.create({ provider }); await api.isReady;

  3. Get the highest block number and log it const blockNumber = await api.derive.chain.bestNumber() console.log(blockNumber)

calmrat commented 1 year ago

https://www.notion.so/cere/How-to-query-the-block-height-of-the-Cere-Mainnet-RPC-node-c7d474c0dcd24fa381662330a5ff0573