For the complete documentation index, see llms.txt. This page is also available as Markdown.

WebSocket Subscriptions

Rome EVM endpoints support Ethereum WebSocket subscriptions (eth_subscribe / eth_unsubscribe) over wss://. Connect to the same host as the HTTPS RPC, with the wss:// scheme:

wss://<chain>.testnet.romeprotocol.xyz/

This is what ethers / viem WebSocketProvider use under the hood, so .on('block'), contract.on(event), and viem's watchEvent / watchBlocks work out of the box.

Subscription types

Type
Fires on
Use for

newHeads

each new block

block tickers, refreshing balances/nonces, per-block bots, indexers

logs

matching events (by address / topics)

reacting to your contract's events, relayers/bridges, trading bots

newPendingTransactions

accepted but never emits (Rome has no public mempool)

ethers (v6)

import { ethers } from "ethers";

const provider = new ethers.WebSocketProvider(
  "wss://martius-i.testnet.romeprotocol.xyz/"
);

// newHeads
provider.on("block", (blockNumber) => {
  console.log("new block", blockNumber);
});

// logs — react to a contract event
const contract = new ethers.Contract(address, abi, provider);
contract.on("Transfer", (from, to, value) => {
  console.log("Transfer", from, to, value.toString());
});

viem

Raw JSON-RPC

For logs, pass a filter object as the second param:

Notes

  • Subscriptions push updates as new blocks are produced (latency is on the order of a block time).

  • For long-lived connections, handle reconnects in your client — standard for any WebSocket RPC.

Last updated

Was this helpful?