Base
准备好在生产环境中调用了吗?
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
Base
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_getLogs returns every event log that matches a filter object — you specify a block range (or a single blockHash), an optional contract address, and optional topics, and get back all matching logs in one shot. It is the primary method for backfilling an index and for one-off historical queries, the workhorse behind dashboards and subgraphs on Base. Base is Coinbase's OP Stack optimistic rollup that settles to Ethereum L1 and uses ETH for gas, with ~2s blocks; its dense event stream from DeFi venues like Aerodrome and Uniswap makes scoped filters important. Send queries to https://base.therpc.io/YOUR_API_KEY (chain ID 8453, hex 0x2105).
Transfer events for an ERC-20 token on Base across a historical block range to build a holder ledger.blockHash plus the contract address and topic.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | filter | object | 是 | Filter object. Fields: `fromBlock` (string, default "latest"), `toBlock` (string, default "latest"), `address` (string | string[]), `topics` ((string | string[] | null)[]), `blockHash` (string — mutually exclusive with fromBlock/toBlock). |
| 类型 | 描述 |
|---|---|
| array | Array of log objects. Each log: `address`, `blockHash`, `blockNumber`, `data`, `logIndex`, `removed` (bool — true on reorg), `topics`, `transactionHash`, `transactionIndex`. |
Try it live in the Base playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32005 | query exceeds max block range | The fromBlock–toBlock window exceeds the provider's block-range cap. |
-32005 | query returned more than 10000 results | Too many matching logs; narrow the filter or paginate. |
-32602 | invalid argument | blockHash combined with fromBlock/toBlock, or malformed topic format. |
removed field and re-query against finalized before treating an event as settled.address or topics filter can time out or hit the block-range and 10,000-result caps — paginate in chunks of roughly 1,000–5,000 blocks, which on Base's ~2s cadence is only minutes of chain time.eth_getLogs with fromBlock: "latest" to watch live events wastes calls; install eth_newFilter + eth_getFilterChanges, or use eth_subscribe, for the live tail.参数
Filter object. Fields: `fromBlock` (string, default "latest"), `toBlock` (string, default "latest"), `address` (string | string[]), `topics` ((string | string[] | null)[]), `blockHash` (string — mutually exclusive with fromBlock/toBlock).