Network Status

RPC health: block height, latency, sync state. Staleness is derived from the age of the last block — a stuck node answers cheerfully with an old height, so "connected" from the node proves nothing.

src/components/ui/network-status.tsx

About

From the component's own source, where it was written.

RPC endpoint health: block height, latency, sync state.

Staleness is derived from the age of the last block, not reported by the node. A stuck node answers every request cheerfully with an old height — it does not know it is stuck — so "connected" from the node itself proves nothing. Comparing the last block time against the chain's expected block time is what actually catches it.

Install

npx astralyx-ui add network-status

Usage

import { NetworkStatus } from '@/components/ui/network-status'

<NetworkStatus chain="Ethereum" blockHeight={21840112} lastBlockAt={last} latency={84} />

Composer

Change the props and the source below follows.

EthereumSynced
Block
21,840,112
Last
Latency
84 ms
Peers
42
Props
tsx
<NetworkStatus chain="Ethereum" blockHeight={21840112} lastBlockAt={last} latency={84} />

Examples

States

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

NetworkStatus

RPC endpoint health: block height, latency, sync state.

Extends Omit<ComponentProps<'div'>, 'children'>.

PropTypeDefaultDescription
chainReactNoderequired—
blockHeightnumber—Reported as given.
lastBlockAtDateblockTime: 12Three missed block times counts as stale — stuck, not merely slow.
nowDate——
latencynumber—Milliseconds. Over a second reads as degraded.
blockTimenumber12Three missed block times counts as stale — stuck, not merely slow.
peersnumber—Reported as given.
localestring'en-GB'—
blockLabelReactNode'Block'—
lastBlockLabelReactNode'Last'Precedes the last-block time.
latencyLabelReactNode'Latency'—
peersLabelReactNode'Peers'—