Skip to content
Zroarus
Documentation menu

viem and ethers

Client configuration, reads, writes and live subscriptions.

TestnetVerified Sep 27, 2026
On this page

viem#

chain.ts
import { defineChain, createPublicClient, createWalletClient, custom, http } from "viem";

export const zroarusTestnet = defineChain({
  id: 305583,
  name: "Zroarus Testnet",
  nativeCurrency: { name: "Zroarus Testnet Token", symbol: "tZROAR", decimals: 18 },
  rpcUrls: { default: { http: ["https://rpc.testnet.zroarus.com"], webSocket: ["wss://rpc.testnet.zroarus.com/ws"] } },
  blockExplorers: { default: { name: "Zroarus Testnet Explorer", url: "https://explorer-testnet.zroarus.com" } },
  contracts: { multicall3: { address: "0xcA11bde05977b3631167028862bE2a173976CA11" } },
  testnet: true,
});

export const publicClient = createPublicClient({ chain: zroarusTestnet, transport: http() });

// In the browser, sign with the user's wallet:
export const walletClient = createWalletClient({ chain: zroarusTestnet, transport: custom(window.ethereum!) });

ethers v6#

provider.ts
import { JsonRpcProvider, Network } from "ethers";

const network = Network.from({ chainId: 305583, name: "zroarus-testnet" });

// staticNetwork skips an eth_chainId round trip on every request
export const provider = new JsonRpcProvider("https://rpc.testnet.zroarus.com", network, { staticNetwork: network });

const block = await provider.getBlockNumber();

Live subscriptions#

The WebSocket endpoint supports eth_subscribe for newHeads and logs.

viem
import { createPublicClient, webSocket } from "viem";
import { zroarusTestnet } from "./chain";

const ws = createPublicClient({ chain: zroarusTestnet, transport: webSocket("wss://rpc.testnet.zroarus.com/ws") });

const unwatch = ws.watchBlocks({ onBlock: (block) => console.log("block", block.number) });
ethers v6
import { WebSocketProvider } from "ethers";

const ws = new WebSocketProvider("wss://rpc.testnet.zroarus.com/ws", 305583);
ws.on("block", (n) => console.log("block", n));

Batching reads#

Multicall3 is deployed at its canonical address (the same address as on Ethereum), so viem's multicall and batch.multicall work with the chain definition above. JSON-RPC batches of up to 1,024 requests are also accepted; see JSON-RPC limits.

Something wrong or missing on this page? Send developer feedback.