Optimism
Optimism
Optimism
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_blockNumber returns the height of the most recently accepted L2 block on OP Mainnet, the OP Stack optimistic rollup that settles to Ethereum and pays gas in ETH. Because OP Mainnet produces a block roughly every 2 seconds, this single integer is the fastest way to know how far the sequencer has advanced. Send the request to https://optimism.therpc.io/YOUR_API_KEY (chain ID 10, 0xa); the response is the latest L2 block number as a hex string.
eth_getLogs ranges across historical Optimism blocks.此方法不需要任何参数,传入空数组 [] 即可。
| 类型 | 描述 |
|---|---|
| string (hex) | Hex-encoded integer block number. Parse with parseInt(value, 16) or BigInt(value). |
Try it live in the Optimism playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32603 | Internal error | Node is not reachable or has not yet produced any block. |
"0x7a1b3c" — run it through parseInt(value, 16) or BigInt(value) before doing any arithmetic.