Skip to main content

ChainGate RPC endpoints

ChainGate provides RPC endpoints for all supported networks — both EVM and UTXO. One API key gives you access to every network -- 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({ apiKey: 'your-api-key' })

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

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

const cg = new ChainGate({ apiKey: 'your-api-key' })
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({ apiKey: 'your-api-key' })

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({ apiKey: 'your-api-key' })
const web3 = new Web3(cg.rpcUrls.ethereum)

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

Direct fetch (EVM)

const cg = new ChainGate({ apiKey: 'your-api-key' })

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.