> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqd.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# evmRpcLatencyWatcher

> Compare block arrival at Portal vs RPC endpoints

Subscribe to RPC endpoints via WebSocket (`eth_subscribe` with `newHeads`) and measure when blocks arrive at the Portal versus when they appear at the RPC. Use this to monitor relative latency.

The watcher is a query-transformer combo that already includes the block query it needs. Pass it directly as the source's `outputs`:

```ts theme={"system"}
import { evmPortalStream, evmRpcLatencyWatcher } from "@subsquid/pipes/evm";

const stream = evmPortalStream({
  id: "indexing-latency",
  portal: "https://portal.sqd.dev/datasets/base-mainnet",
  outputs: evmRpcLatencyWatcher({
    rpcUrl: ["https://base.drpc.org", "https://base-rpc.publicnode.com"],
  }),
});

for await (const { data } of stream) {
  if (!data) continue;
  console.table(data.rpc); // url, hash, receivedAt, portalDelayMs
}
```

**Parameters:**

* `rpcUrl`: Array of RPC WebSocket or HTTP URLs to compare against Portal

**Output:** Each batch carries the observed block's `number` and `timestamp`, `portal.receivedAt` (when the block arrived from the Portal), and an `rpc` array with `url`, `hash`, `receivedAt`, and `portalDelayMs` per endpoint.

<Warning>
  Measured values include client-side network latency. Results are end-to-end delays as seen by the client, not pure Portal or RPC processing performance.
</Warning>

See the [Data freshness monitoring guide](../../guides/advanced-topics/latency-monitoring) for a complete example with Prometheus metrics.


## Related topics

- [Data freshness monitoring](/en/sdk/pipes-sdk/evm/guides/advanced-topics/latency-monitoring.md)
- [solanaRpcLatencyWatcher](/en/sdk/pipes-sdk/solana/reference/utility-components/rpc-latency-watcher.md)
- [Bitcoin portal stream](/en/sdk/pipes-sdk/bitcoin/reference/basic-components/source.md)
- [Pipes SDK 1.0](/announcements/pipes-sdk-1-0.md)
- [Changelog](/changelog.md)
