Ethereum
准备好在生产环境中调用了吗?
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
Ethereum
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
eth_getUncleCountByBlockNumber returns how many uncles a block references, addressed by height or by a tag such as latest, finalized, or earliest. It is the height-keyed counterpart to the hash version, and the one that fits a loop incrementing a block number across Ethereum history. The count reflects the chain's consensus era: pre-Merge PoW blocks (below 15537393) can carry up to two uncles and report 0x1 or 0x2, while every PoS block since The Merge reports 0x0 because the protocol no longer mints ommers. The endpoint is https://ethereum.therpc.io/YOUR_API_KEY on chain ID 1, and the result is a hex-encoded integer.
eth_getUncleByBlockNumberAndIndex: only fetch headers for heights where the count is non-zero.| # | 名称 | 类型 | 必填 | 描述 |
|---|---|---|---|---|
| 1 | blockTag | string | 是 | The block to count uncles in. |
| 类型 | 描述 |
|---|---|
| string (hex) | Hex-encoded uncle count. |
Try it live in the Ethereum playground.
| 错误码 | 错误信息 | 原因 |
|---|---|---|
-32602 | Invalid params | Block tag is malformed or unrecognised. |
0x0 no matter which height you pass, because PoS Ethereum never produces uncles. Restrict meaningful queries to the PoW range below that."0x2" will not compare as the number 2 directly. Parse it (for example parseInt(result, 16)) before doing any arithmetic or threshold check.参数
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"