Skip to main content

chain_subscribeNewHeads – Mythos JSON-RPC Method

Subscribes to every new block header produced by Mythos, regardless of finality. Use this call for dashboards, live mint trackers, or monitoring collator performance.

Parameters#

This subscription takes no parameters.

Example (JavaScript)#

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

const provider = new WsProvider('wss://api-mythos-archive.n.dwellir.com/YOUR_API_KEY');
const api = await ApiPromise.create({ provider });

const unsubscribe = await api.rpc.chain.subscribeNewHeads((header) => {
console.log(`New Mythos head #${header.number}:`, header.hash.toHex());
});

Notes#

  • Headers streamed through this method are not yet finalized; pair with chain_subscribeFinalizedHeads or chain_getFinalizedHead when a finalized view is required.
  • Efficiently cache metadata and decoding logic to handle bursts during high-traffic events.