DEV Community

Cover image for Measuring Avalanche C-Chain block cadence with 40 lines of Node
Cambixa
Cambixa

Posted on

Measuring Avalanche C-Chain block cadence with 40 lines of Node

Why look at block timing now

On 9 November 2026, Ava Labs said Avalanche will be the core ledger technology for the clearing firm behind NYSE's planned tokenized securities venue, built for 24/7 trading, clearing and settlement pending regulatory approval (Cointelegraph, Decrypt, The Block). NYSE says the stocks can be issued on several chains, while one ledger records and settles the trades.

Settlement speed is the pitch, so I wanted real numbers instead of a marketing figure. The script below asks a public Avalanche C-Chain RPC node for the last N blocks and reports the gaps between their timestamps.

The script

It uses only built-in fetch (Node 18+) and plain JSON-RPC: eth_blockNumber and eth_getBlockByNumber. The C-Chain speaks the Ethereum RPC dialect, so nothing Avalanche-specific is needed.

// block-cadence.mjs
// Usage: node block-cadence.mjs [N] [rpc]
const N = Number(process.argv[2] || 200);
const RPC = process.argv[3] || 'https://api.avax.network/ext/bc/C/rpc';

async function rpc(method, params) {
  const res = await fetch(RPC, {
    method: 'POST',
    headers: { 'content-type': 'application/json' },
    body: JSON.stringify({ jsonrpc: '2.0', id: 1, method, params }),
  });
  const json = await res.json();
  if (json.error) throw new Error(json.error.message);
  return json.result;
}

const head = parseInt(await rpc('eth_blockNumber', []), 16);
const blocks = [];
for (let n = head - N; n <= head; n += 20) {
  const batch = [];
  for (let k = n; k < Math.min(n + 20, head + 1); k++)
    batch.push(rpc('eth_getBlockByNumber', ['0x' + k.toString(16), false]));
  blocks.push(...(await Promise.all(batch)));
}

// newer blocks also carry a millisecond timestamp; fall back to seconds
const ms = (b) => (b.timestampMilliseconds
  ? parseInt(b.timestampMilliseconds, 16)
  : parseInt(b.timestamp, 16) * 1000);

const gaps = [];
for (let i = 1; i < blocks.length; i++) gaps.push(ms(blocks[i]) - ms(blocks[i - 1]));
gaps.sort((a, b) => a - b);
const pct = (p) => gaps[Math.min(gaps.length - 1, Math.floor((p / 100) * gaps.length))];
const span = (ms(blocks.at(-1)) - ms(blocks[0])) / 1000;
const txs = blocks.reduce((s, b) => s + b.transactions.length, 0);

console.log(`C-Chain blocks ${head - N}..${head} (${blocks.length} blocks over ${span.toFixed(1)} s)`);
console.log(`gap between blocks: median ${pct(50)} ms, p90 ${pct(90)} ms, max ${gaps.at(-1)} ms`);
console.log(`transactions: ${txs} (${(txs / span).toFixed(1)} per second)`);
Enter fullscreen mode Exit fullscreen mode

Blocks are fetched in batches of 20 so a free node doesn't rate-limit you, and the gaps are sorted once so percentiles are a simple index.

What it printed

Run at 01:44 UTC on 10 November 2026 against https://avalanche-c-chain-rpc.publicnode.com:

C-Chain blocks 99898214..99898414 (201 blocks over 206.7 s)
gap between blocks: median 700 ms, p90 1729 ms, max 4909 ms
transactions: 651 (3.1 per second)
Enter fullscreen mode Exit fullscreen mode

That was a quiet hour in Europe and the US, so the gaps are probably wider than at peak. Run it a few times across the day before you quote a number.

A networking gotcha

On one Windows machine the first run failed with fetch failed and ETIMEDOUT while curl to the same node worked. Node's happy-eyeballs logic gives each address 250 ms by default, and the IPv6 routes were unreachable. Raising the per-attempt timeout fixed it:

node --network-family-autoselection-attempt-timeout=3000 block-cadence.mjs 200 https://avalanche-c-chain-rpc.publicnode.com
Enter fullscreen mode Exit fullscreen mode

What the numbers don't tell you

A block landing is not the same as a trade being final in the legal sense, and NYSE hasn't said whether its ledger will be the public C-Chain or a dedicated Avalanche chain. Its stated need to control who participates hints at some permissioning. The script measures one public chain at one moment, which is useful for comparing chains or watching a node, and not more than that.

Ideas to extend it

  • Pass a different RPC URL to compare chains that use the Ethereum dialect.
  • Log gasUsed / gasLimit per block to see how full blocks are.
  • Run it on a cron and chart the median over a week.

Top comments (0)