Ethereum

Ethereum

Quick Start

TheRPC gives you a hosted JSON-RPC endpoint for Ethereum mainnet so you can read state, watch blocks, and broadcast transactions without running your own geth or erigon node. Developers reach for it to skip the sync, storage, and uptime work of self-hosting and still talk to chain 1 over the standard protocol their tools already speak. This guide takes you from no account to a working eth_blockNumber response in a few minutes: get a key, point your environment at the Ethereum endpoint, and fire the first call in curl, JavaScript, or Python.

Step 1: Get an API Key

Sign up at TheRPC.io, then open the Dashboard and head to the API Keys section to generate a key or copy an existing one. The key is a single opaque string that becomes part of your endpoint URL — it takes the place of YOUR_API_KEY in https://ethereum.therpc.io/YOUR_API_KEY and is also sent as a Bearer token in the Authorization header. The same key works across every network TheRPC serves, so you only do this once.

Step 2: Choose Your Network

TheRPC serves many networks, and each has its own hostname. For Ethereum mainnet you want ethereum.therpc.io. Set the endpoint and your key as environment variables so the rest of your code stays clean and the key never gets hardcoded. If you later need a testnet, the only thing that changes is the host — the request format and key stay the same.

Step 2: Choose Your Network

API_ENDPOINT="https://ethereum.therpc.io/YOUR_API_KEY"
API_KEY="YOUR_API_KEY"

Step 3: Make Your First Call

Below is the same eth_blockNumber call in three forms — curl, JavaScript with axios, and Python with requests — so you can run whichever matches your stack. It returns the current chain head as a hex string; decoding it confirms your key and endpoint are live. For other languages and richer client setups, see Tools & SDKs.

Using Curl

curl --request POST https://ethereum.therpc.io/YOUR_API_KEY \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'

Using JavaScript

const axios = require('axios');
const config = {
url: 'https://ethereum.therpc.io/YOUR_API_KEY',
apiKey: 'YOUR_API_KEY',
};
async function getBlockNumber() {
const response = await axios.post(
config.url,
{
jsonrpc: '2.0',
method: 'eth_blockNumber',
params: [],
id: 1,
},
{
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${config.apiKey}`,
},
},
);
console.log('Latest Block Number:', response.data.result);
}

Using Python

import requests
config = {
'url': 'https://ethereum.therpc.io/YOUR_API_KEY',
'api_key': 'YOUR_API_KEY'
}
def get_block_number():
response = requests.post(
config['url'],
headers={
'Content-Type': 'application/json',
'Authorization': f"Bearer {config['api_key']}"
},
json={
'jsonrpc': '2.0',
'method': 'eth_blockNumber',
'params': [],
'id': 1
}
)
return response.json()['result']

Step 4: Using Web3 Libraries

Raw HTTP is fine for a single call, but once you are encoding contract calldata, decoding return values, signing transactions, or managing nonces, a Web3 library does that work for you. ethers.js and web3.js in JavaScript, or web3.py in Python, handle ABI encoding, unit conversion between wei and ETH, and transaction building so you are not assembling hex by hand. See Tools & SDKs for full, language-specific setups.

Web3.js (JavaScript)

const Web3 = require('web3');
const web3 = new Web3('https://ethereum.therpc.io/YOUR_API_KEY');
// Add API key to requests
web3.setHeader('Authorization', 'Bearer YOUR_API_KEY');
async function getBalance(address) {
const balance = await web3.eth.getBalance(address);
return web3.utils.fromWei(balance, 'ether');
}

Web3.py (Python)

from web3 import Web3
from web3.middleware import http_retry_request_middleware
w3 = Web3(Web3.HTTPProvider(
'https://ethereum.therpc.io/YOUR_API_KEY',
request_kwargs={
'headers': {'Authorization': 'Bearer YOUR_API_KEY'}
}
))
# Add retry middleware
w3.middleware_onion.add(http_retry_request_middleware)

Available Methods

The All Methods page indexes every Ethereum JSON-RPC method TheRPC serves on chain 1, grouped by namespace. Each method has its own page with a description, the parameter and return tables, the error codes it can raise, a runnable request example, common use cases, and its CU cost. That is where you go once you move past eth_blockNumber into balances, logs, contract calls, or tracing.

Network Selection

Each network TheRPC supports has its own endpoint, distinguished by hostname. For Ethereum mainnet the URL is https://ethereum.therpc.io/YOUR_API_KEY over HTTP, with wss://ethereum.therpc.io/YOUR_API_KEY for WebSocket subscriptions. To target a different chain, you swap the host and keep everything else.

Next Steps

  • All Methods — browse the full Ethereum method reference and find what you need next.
  • Tools & SDKs — set up ethers.js, web3.js, web3.py, web3j, or another client for chain 1.
  • Authentication — secure your key, rotate it, and read auth errors properly.
  • Rate Limits — understand CU billing and how to stay within your plan's limits.
  • Basic Operations — work through the everyday calls: balances, receipts, blocks, and contract reads.

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.