Polygon
Polygon
Polygon
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_blockNumber returns the height of the most recently accepted block on Polygon PoS — the latest block sealed by a Bor producer. Because Polygon mines a new block roughly every 2 seconds, this value moves fast and is the simplest way to confirm your node is keeping up with the head of the chain. Gas on Polygon is paid in MATIC, but this call costs nothing on-chain: it is a pure read. Send it to https://polygon.therpc.io/YOUR_API_KEY (chain ID 137, 0x89) and you get back the current block height as a hex string.
polygon.therpc.io is up and synced to the Polygon head.eth_getLogs over a historical range.此方法不需要任何参数,传入空数组 [] 即可。
| 类型 | 描述 |
|---|---|
| string (hex) | Hex-encoded integer block number. Parse with parseInt(value, 16) or BigInt(value). |
Try it live in the Polygon playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32603 | Internal error | Node is not reachable or has not yet produced any block. |
0x3a1f2c, not a number — run parseInt(value, 16) or BigInt(value) before any arithmetic.