EVM RPC explorer
EvmRpcExplorer is a typed wrapper around standard Ethereum JSON-RPC. It works with any EVM-compatible chain — you create the network via cg.networks.evmRpc({ rpcUrl, chainId, ... }) and ChainGate handles the rest.
The rpcUrl you pass can be either:
- One of ChainGate's hosted RPC proxies (
cg.rpcUrls.ethereum,cg.rpcUrls.polygon,cg.rpcUrls.avalanche, etc.) — authenticated with your ChainGate API key, no extra signup needed. See ChainGate RPC endpoints for the full list. - Any external JSON-RPC URL — Infura, Alchemy, QuickNode, a public endpoint, or a node you run yourself.
Both flavors give you the exact same EvmRpcExplorer API; the only difference is who hosts the underlying RPC node.
With ChainGate's hosted RPC
import { ChainGate } from 'chaingate'
const cg = new ChainGate()
const polygon = cg.networks.evmRpc({
rpcUrl: cg.rpcUrls.polygon, // ChainGate-hosted RPC, authenticated by your API key
chainId: 137,
name: 'Polygon',
symbol: 'POL',
})
const explorer = cg.explore(polygon)
With an external RPC
const bsc = cg.networks.evmRpc({
rpcUrl: 'https://bsc-dataseed.binance.org', // any third-party or self-hosted RPC
chainId: 56,
name: 'BNB Smart Chain',
symbol: 'BNB',
})
const explorer = cg.explore(bsc)
Available methods
| Method | JSON-RPC call | Description |
|---|---|---|
getBalance(address) | eth_getBalance | Native balance |
getTransactionCount(address) | eth_getTransactionCount (latest) | Confirmed transaction count |
getNonce(address) | eth_getTransactionCount (pending) | Next nonce to use |
estimateGas(params) | eth_estimateGas | Gas estimate |
getFeeData() | eth_gasPrice + EIP-1559 | Fee data (gas price, max fee, priority fee) |
sendRawTransaction(rawTx) | eth_sendRawTransaction | Broadcast a signed transaction |
getTransactionReceipt(txHash) | eth_getTransactionReceipt | Transaction receipt |
Example
const explorer = cg.explore(bsc)
// Check balance
const balance = await explorer.getBalance('0x...')
// Fetch current gas prices (works the same way on Polygon, BNB, Avalanche, etc.)
const feeData = await explorer.getFeeData()
console.log('Gas price:', feeData.gasPrice)
// Transaction receipt
const receipt = await explorer.getTransactionReceipt('0xtxhash...')
console.log('Status:', receipt.status)
How this fits with the rest of the EVM stack
ChainGate has three EVM-related things that are easy to mix up:
EvmRpcExplorer(this page) — typed wrapper around standard JSON-RPC. TherpcUrlyou pass can be one of ChainGate's hosted ones (cg.rpcUrls.*), or any external RPC (Infura, Alchemy, your own node). Limited to standard Ethereum RPC methods.cg.rpcUrls.*— JSON-RPC endpoints ChainGate hosts. Plug them intocg.networks.evmRpc()(which is what gets you here), or use them directly with ethers.js, viem, web3.js, or plainfetch. See ChainGate RPC endpoints.EvmExplorer— high-level explorer for natively supported chains (Ethereum and Avalanche). Talks to ChainGate's REST API and returns enriched data: token balances, transaction history, NFT metadata, congestion.
Pointing EvmRpcExplorer at cg.rpcUrls.ethereum or cg.rpcUrls.avalanche works fine, but for token aggregation, history, NFT metadata, or congestion on those chains you want EvmExplorer instead.