Polygon
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.
Polygon
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
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.| # | 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 Polygon playground.
| Código | Mensagem | Causa |
|---|---|---|
-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.Parâmetros
hex block number or "latest"/"earliest"/"pending"/"safe"/"finalized"