Ethereum
Pronto para usar isso em produção?
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
Ethereum
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
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.| # | Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|---|
| 1 | blockTag | string | Sim | The block to count uncles in. |
| Tipo | Descrição |
|---|---|
| string (hex) | Hex-encoded uncle count. |
Try it live in the Ethereum playground.
| Código | Mensagem | 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"