Etherscan (Web3) API
Read Ethereum on-chain data — balances, transactions, contracts, gas.
What it does
Beyond account and token history, Etherscan’s API has a ‘Web3’ side: a JSON-RPC proxy (call standard eth_* methods through your Etherscan key), verified contract source and ABI retrieval, contract read/write metadata, event log queries, and a gas oracle — useful for interacting with contracts without running a node.
Base URL
Authentication
Same free key as the rest of the Etherscan API, passed as &apikey=YOUR_KEY. The proxy module is module=proxy; contract endpoints are module=contract; logs are module=logs. V2 adds chainid for 50+ EVM chains.
Code examples
curl -s "https://api.etherscan.io/api?module=proxy&action=eth_blockNumber&apikey=$ETHERSCAN_KEY"
import requests, json
addr = "0xdAC17F958D2ee523a2206206994597C13D831ec7" # USDT
r = requests.get("https://api.etherscan.io/api", params={
"module": "contract", "action": "getabi",
"address": addr, "apikey": KEY}, timeout=15)
abi = json.loads(r.json()["result"])
print([f["name"] for f in abi if f["type"] == "function"][:8])Rate limits & quotas
The free-tier limits are shared with the whole Etherscan API: 5 calls/second and 100,000 calls/day. The proxy module returns raw JSON-RPC ({jsonrpc, id, result}), while module=contract/logs use the Etherscan {status, message, result} envelope — watch for the mismatch.
Key response fields
| (proxy) result | Raw JSON-RPC result, hex-encoded |
| (getabi) result | ABI as a JSON string — json.loads it |
| (getsourcecode) result[0].SourceCode / ContractName / CompilerVersion | Verified source metadata |
| (getLogs) result[] | Event logs with topics, data, block/tx refs |
| (gastracker) result.SafeGasPrice / ProposeGasPrice / FastGasPrice | Gas oracle (gwei) |
Common errors
| status 0, 'Contract source code not verified' | getabi/getsourcecode only work for verified contracts. |
| status 0, 'Max rate limit reached' | Over 5 calls/second. |
| (proxy) error object | Standard JSON-RPC error (e.g. execution reverted) inside the proxy response. |
| (getLogs range too wide) | Etherscan caps the block span and result count — page with fromBlock/toBlock. |
When to use it (and alternatives)
Handy when you want contract ABIs, source and log queries plus occasional RPC calls from one free key, without standing up an Alchemy or Infura endpoint. For high-throughput RPC or archive access, use a real node provider. For address/token transaction history, see Etherscan.
FAQ
How is this different from the main Etherscan API page?
Same API and key. That page covers account balances and transaction/token history; this one covers the contract-interaction side — the JSON-RPC proxy, verified ABIs and source, event logs and the gas oracle.
Can I send transactions through the proxy?
You can relay a signed raw transaction with proxy&action=eth_sendRawTransaction, but sign it client-side — never send a private key to any API.
Why does the proxy response look different from other Etherscan calls?
The proxy module passes JSON-RPC through verbatim ({jsonrpc, id, result}). Other modules wrap results in Etherscan’s {status, message, result}. Handle both shapes.
New to APIs?
Short guides for working with this API — and any other.