Polygon
Polygon
Polygon
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
eth_chainId returns the EIP-155 chain ID of the network the endpoint is serving. For Polygon PoS mainnet — the Proof-of-Stake chain where gas is paid in MATIC — that value is 0x89, decimal 137. Calling https://polygon.therpc.io/YOUR_API_KEY should always return 0x89; anything else means you are talking to a different network. The chain ID is what EIP-155 mixes into the signature of every Polygon transaction, which is exactly why wallets and signers check it before broadcasting.
0x89) and not Ethereum mainnet or the Amoy testnet before submitting.eth_blockNumber for a full "alive and on chain 137" health probe of polygon.therpc.io.0xc2132D05D31c914a87C6611C10748AEb04B58e8F only when the ID is 137.Este método não aceita parâmetros. Passe um array vazio [].
| Tipo | Descrição |
|---|---|
| string (hex) | Hex-encoded chain ID integer (e.g. "0x1" for Ethereum mainnet). |
Try it live in the Polygon playground.
| Código | Mensagem | Causa |
|---|---|---|
-32603 | Internal error | Node failed to retrieve chain configuration. |
net_version, which returns the network ID as a decimal string ("137"); eth_chainId returns the hex chain ID ("0x89"). They happen to match in value on Polygon but differ in format, and on some networks differ outright.BigInt(result) === 137n rather than a raw string match, so "0x89" and "0x089" are treated as equal.