Ethereum
¿Listo para usar esto en producción?
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
Ethereum
El plan gratuito cubre proyectos personales. El pago por uso escala sin necesidad de tarjeta.
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.| # | Nombre | Tipo | Requerido | Descripción |
|---|---|---|---|---|
| 1 | blockTag | string | Sí | The block to count uncles in. |
| Tipo | Descripción |
|---|---|
| string (hex) | Hex-encoded uncle count. |
Try it live in the Ethereum playground.
| Código | Mensaje | Causa |
|---|---|---|
-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.Parámetros
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"