Ethereum API
Ethereum 端点通过 HTTPS 使用 EVM JSON-RPC Core API;路由启用时也可使用 WSS。
Endpoint
| Item | Value |
|---|---|
| Network | Ethereum Mainnet |
| Protocol | EVM JSON-RPC 2.0 |
| Chain ID | 1 (0x1) |
| Public HTTPS | https://ethereum-rpc.blockreq.com/v1/rpc/public |
| Private HTTPS | https://ethereum-rpc.blockreq.com/v1/rpc/BRQ1P0000000000000000000000000000000000000000000000000000000 |
| WSS | wss://ethereum-rpc.blockreq.com/v1/rpc/BRQ1P0000000000000000000000000000000000000000000000000000000,启用时可用 |
Core Methods
请求结构见 EVM JSON-RPC 方法表,计费见 Request Counting。
| 类别 | 方法 |
|---|---|
| Chain 和 blocks | eth_chainId, eth_blockNumber, eth_getBlockByNumber, eth_getBlockByHash |
| State 和 archive | eth_getBalance, eth_getCode, eth_getStorageAt, eth_call, eth_getProof |
| Logs 和 transactions | eth_getLogs, eth_getTransactionByHash, eth_getTransactionReceipt |
| All history / execution replay | debug_traceCall, debug_traceTransaction, debug_traceBlockByNumber, trace_block, trace_call, trace_filter, trace_transaction |
| Subscriptions | WSS 上的 eth_subscribe, eth_unsubscribe |
Archive 和 All History
Ethereum 历史状态调用需要 archive-capable route,包括旧区块 eth_call、旧区块 balance/code/storage/nonce 读取、eth_getProof,以及 debug_* 或 trace_* replay 方法。eth_getLogs 是历史查询,但通常由 logs/index-capable lane 承接,不等同于完整 archive state。
curl -X POST https://ethereum-rpc.blockreq.com/v1/rpc/BRQ1P0000000000000000000000000000000000000000000000000000000 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getProof","params":["0x0000000000000000000000000000000000000000",[],"latest"],"id":1}'Debug 和 Trace
只要 Ethereum 路由支持该方法,所有付费套餐都可以调用 debug_*、trace_* 与 txpool_*。Free 赠送不包含这些方法。
curl -X POST https://ethereum-rpc.blockreq.com/v1/rpc/BRQ1P0000000000000000000000000000000000000000000000000000000 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"debug_traceCall","params":[{"to":"0xdac17f958d2ee523a2206206994597c13d831ec7","data":"0x313ce567"},"latest",{"tracer":"callTracer"}],"id":1}'