Skip to main content

ChainGate RPC endpoints

ChainGate provides RPC endpoints for all supported networks — both EVM and UTXO. One API key gives you a free Ethereum RPC, a Polygon endpoint for live gwei pricing, an Avalanche RPC, and endpoints for every other supported chain — no need to sign up with Infura, Alchemy, or any other provider.

Available networks​

Access the endpoints via cg.rpcUrls:

import { ChainGate } from 'chaingate'

const cg = new ChainGate()

console.log(cg.rpcUrls.ethereum) // https://api.chaingate.dev/rpc/ethereum?api_key=...
console.log(cg.rpcUrls.bitcoin) // https://api.chaingate.dev/rpc/bitcoin?api_key=...
console.log(cg.rpcUrls.polygon) // https://api.chaingate.dev/rpc/polygon?api_key=...

EVM networks​

NetworkPropertyChain ID
Ethereumcg.rpcUrls.ethereum1
Polygoncg.rpcUrls.polygon137
Arbitrumcg.rpcUrls.arbitrum42161
Basecg.rpcUrls.base8453
Avalanchecg.rpcUrls.avalanche43114
BNB Smart Chaincg.rpcUrls.bnb56
Soniccg.rpcUrls.sonic146

UTXO networks​

NetworkProperty
Bitcoincg.rpcUrls.bitcoin
Bitcoin Testnetcg.rpcUrls.bitcoinTestnet
Bitcoin Cashcg.rpcUrls.bitcoincash
Litecoincg.rpcUrls.litecoin
Dogecoincg.rpcUrls.dogecoin
Free tier included

All RPC endpoints are included in the free API key. Get yours at ChainGate's Dashboard.

Use with external libraries​

These are standard JSON-RPC endpoints. They work with any Ethereum library out of the box — ethers.js, viem, web3.js, or plain fetch.

ethers.js​

import { ethers } from 'ethers'
import { ChainGate } from 'chaingate'

const cg = new ChainGate()
const provider = new ethers.JsonRpcProvider(cg.rpcUrls.ethereum)

const blockNumber = await provider.getBlockNumber()
const balance = await provider.getBalance('0x...')
console.log('Block:', blockNumber, 'Balance:', ethers.formatEther(balance))

viem​

import { createPublicClient, http } from 'viem'
import { mainnet } from 'viem/chains'
import { ChainGate } from 'chaingate'

const cg = new ChainGate()

const client = createPublicClient({
chain: mainnet,
transport: http(cg.rpcUrls.ethereum),
})

const blockNumber = await client.getBlockNumber()
const balance = await client.getBalance({ address: '0x...' })

web3.js​

import Web3 from 'web3'
import { ChainGate } from 'chaingate'

const cg = new ChainGate()
const web3 = new Web3(cg.rpcUrls.ethereum)

const blockNumber = await web3.eth.getBlockNumber()
const balance = await web3.eth.getBalance('0x...')

Read current Polygon gas prices (gwei)​

import { ethers } from 'ethers'

const provider = new ethers.JsonRpcProvider(cg.rpcUrls.polygon)
const feeData = await provider.getFeeData()

console.log('Gas price (gwei):', ethers.formatUnits(feeData.gasPrice ?? 0n, 'gwei'))

Direct fetch (EVM)​

const cg = new ChainGate()

const response = await fetch(cg.rpcUrls.ethereum, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_blockNumber',
params: [],
id: 1,
}),
})

const { result } = await response.json()
console.log('Block number:', parseInt(result, 16))
info

The RPC URLs already include your API key as a query parameter. No additional authentication headers are needed.

Prefer push over polling?

The same API key also opens the real-time event streams — new blocks, balance changes, transaction activity and pending transactions per address, delivered over WebSocket on Bitcoin, Litecoin, Dogecoin, Bitcoin Cash, Ethereum and Avalanche. See Events.