Polygon
Polygon
Polygon
Le niveau gratuit couvre les projets personnels. Le paiement à l'usage évolue sans carte bancaire.
eth_blockNumber returns the height of the most recently accepted block on Polygon PoS — the latest block sealed by a Bor producer. Because Polygon mines a new block roughly every 2 seconds, this value moves fast and is the simplest way to confirm your node is keeping up with the head of the chain. Gas on Polygon is paid in MATIC, but this call costs nothing on-chain: it is a pure read. Send it to https://polygon.therpc.io/YOUR_API_KEY (chain ID 137, 0x89) and you get back the current block height as a hex string.
polygon.therpc.io is up and synced to the Polygon head.eth_getLogs over a historical range.Cette méthode ne prend aucun paramètre. Passez un tableau vide [].
| Type | Description |
|---|---|
| string (hex) | Hex-encoded integer block number. Parse with parseInt(value, 16) or BigInt(value). |
Try it live in the Polygon playground.
| Code | Message | Cause |
|---|---|---|
-32603 | Internal error | Node is not reachable or has not yet produced any block. |
0x3a1f2c, not a number — run parseInt(value, 16) or BigInt(value) before any arithmetic.