Skip to main content

EVM explorer

EvmExplorer provides methods for natively supported EVM networks: Ethereum and Avalanche. It queries data through ChainGate's REST API — not through JSON-RPC — which lets it return enriched responses that a raw RPC node can't produce on its own: aggregated token balances (ERC-20/721/1155), paginated transaction history, network status with congestion metrics, NFT metadata, and more. Use it as a programmatic alternative to tools like Etherscan or Snowtrace, with a single API key.

import { ChainGate } from 'chaingate'

const cg = new ChainGate()
const eth = cg.explore(cg.networks.ethereum)
const avax = cg.explore(cg.networks.avalanche)

Available methods

MethodDescription
getAddressBalance(address)Confirmed and unconfirmed balances
getAddressHistory(address, page?)Paginated transaction history
getAddressTokenBalances(address)ERC-20/ERC-721/ERC-1155 token balances
getAddressTransactionCount(address)Transaction count (nonce)
getTransactionDetails(txId)Full transaction details
getLatestBlock()Latest block header
getBlockByHeight(height)Fetch block by height
getBlockByHash(hash)Fetch block by hash
estimateGas(params)Estimate gas for a transaction
getFeeRate()Current gas prices by tier (low/normal/high/maximum), in gwei
getNetworkStatus()Real-time metrics: block time, base fee (wei & gwei), EIP-1559 tips, and network congestion
getNonce(address)Next nonce to use for a transaction from this address (counts pending transactions)
broadcastTransaction(rawTx)Broadcast a signed raw transaction
callSmartContract(params)Read-only smart contract call
getTokenData(contractAddress)Token metadata (name, symbol, decimals)
getTokenLogoUrl(contractAddress)Token logo URL
getNftMetadata(contractAddress, tokenId)NFT metadata
getNetworkLogoUrl()Network logo URL

Example

const eth = cg.explore(cg.networks.ethereum)

// Balance — with built-in ETH → USD conversion
const balance = await eth.getAddressBalance('0x...')
console.log('ETH balance:', balance.confirmed.base(), balance.confirmed.symbol)
console.log('ETH/USD:', await balance.confirmed.toCurrency('usd'))

// Token balances
const tokens = await eth.getAddressTokenBalances('0x...')
for (const token of tokens) {
console.log(token.symbol, token.base())
}

// Read a smart contract
const result = await eth.callSmartContract({
to: '0xContractAddress...',
data: '0xEncodedCallData...',
})

// Token metadata — useful to verify a token before interacting with it
const tokenData = await eth.getTokenData('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48')
console.log(tokenData.name) // 'USD Coin'
console.log(tokenData.symbol) // 'USDC'

Current gas prices (gwei)

getFeeRate() returns four priority tiers with values already denominated in gwei — ideal for building a gas tracker widget or auto-picking a tier:

const fees = await eth.getFeeRate()
console.log('Low (gwei):', fees.low.maxFeePerGasGwei)
console.log('Normal (gwei):', fees.normal.maxFeePerGasGwei)
console.log('High (gwei):', fees.high.maxFeePerGasGwei)
console.log('Maximum (gwei):', fees.maximum.maxFeePerGasGwei)
console.log('Normal tip (gwei):', fees.normal.maxPriorityFeePerGasGwei)
console.log('Normal ETA (s):', fees.normal.confirmationTimeSecs)

Network status & congestion

getNetworkStatus() returns current and predicted base fee (wei and gwei), EIP-1559 tip predictions, average block time, and a networkOccupation ratio (0–1) that tells you how saturated the chain is:

const status = await eth.getNetworkStatus()
console.log('Base fee (gwei):', status.currentBaseFeeGWei)
console.log('Predicted next base fee (gwei):', status.predictedBaseFeeGWei)
console.log('Avg block time (s):', status.blockTimeSecs)
console.log('Network occupation (0-1):', status.networkOccupation)
console.log('EIP-1559 supported:', status.supportsEIP1559)

for (const tip of status.predictedTips) {
console.log(`${tip.expectedConfirmationTimeSecs}s → ${tip.predictedTipGWei} gwei tip`)
}

networkOccupation is a direct indicator of network congestion: 0 means empty blocks, 1 means blocks are full and gas prices tend to spike. Combine it with getFeeRate() for a complete view of the chain's current load.

Pending transactions & tip tuning

If a send is stuck in the mempool, getNetworkStatus().predictedTips tells you how much priority tip (in gwei) to include at each target confirmation speed — useful when deciding whether to replace a pending transaction with a higher-fee one:

const status = await eth.getNetworkStatus()

for (const tip of status.predictedTips) {
console.log(`${tip.expectedConfirmationTimeSecs}s → ${tip.predictedTipGWei} gwei tip`)
}

Use getAddressHistory() to list a wallet's confirmed transactions once they land:

const history = await eth.getAddressHistory('0x...')

for (const tx of history.transactions) {
console.log(tx.txHash, 'in block', tx.blockHeight)
}

How this fits with the rest of the EVM stack

ChainGate has three EVM-related things that are easy to mix up:

  • EvmExplorer (this page) — talks to ChainGate's REST API. Returns enriched data that a raw RPC node can't produce: aggregated token balances, transaction history, NFT metadata, congestion. Available for Ethereum and Avalanche.
  • cg.rpcUrls.* — JSON-RPC endpoints ChainGate hosts. Plug them into ethers.js, viem, web3.js, fetch, or cg.networks.evmRpc(). Cover Ethereum, Polygon, Arbitrum, Base, Avalanche, BNB Smart Chain, and Sonic. See ChainGate RPC endpoints.
  • EvmRpcExplorer — typed wrapper around standard JSON-RPC. The rpcUrl you pass can be one of ChainGate's hosted ones above, or any external RPC (Infura, Alchemy, your own node). Limited to standard Ethereum RPC methods.

Reach for EvmExplorer whenever you need anything beyond raw RPC on Ethereum or Avalanche; reach for EvmRpcExplorer for any other EVM chain, or when raw JSON-RPC is enough.