Polygon
Polygon
Polygon
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_getUncleCountByBlockNumber returns, as a hex string, the number of uncle blocks referenced by the block at a given height or block tag (latest, earliest, safe, finalized, and so on). On Polygon — the PoS network whose gas token is MATIC, served at https://polygon.therpc.io/YOUR_API_KEY (chain ID 137, 0x89) — the answer is always "0x0", since its Bor/Heimdall consensus with L1 checkpoints does not fork into uncles. The method is the height-addressed counterpart of eth_getUncleCountByBlockHash and is kept for Ethereum JSON-RPC compatibility.
"0x0", so the computed rate is zero — a direct reflection of its forkless PoS design.eth_getUncleByBlockNumberAndIndex; since Polygon's count is always "0x0", you can skip that follow-up entirely.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | blockTag | string | 是 | The block to count uncles in. |
| 类型 | 描述 |
|---|---|
| string (hex) | Hex-encoded uncle count. |
Try it live in the Polygon playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32602 | Invalid params | Block tag is malformed or unrecognised. |
"0x0" regardless of which block or tag you pass, so do not write branching logic that assumes a height could ever carry uncles here."0x0"), not a number — convert it (e.g. parseInt(result, 16)) before doing any numeric comparison or arithmetic.参数
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"