Polygon
Polygon
Polygon
O plano gratuito cobre projetos pessoais. O pay-as-you-go escala sem cartão de crédito.
net_version returns the network ID of the chain a node is connected to, as a decimal string. For Polygon PoS mainnet — the MATIC-fee network — the value is "137", which matches its chain ID. It is a fast way to confirm you are talking to Polygon rather than Ethereum or another EVM chain before sending requests. Call it against the Polygon mainnet endpoint at https://polygon.therpc.io/YOUR_API_KEY (chain ID 137, 0x89) and you should get "137" back.
"137") before submitting a MATIC transaction, guarding against accidental sends on the wrong network."137") from the Amoy testnet ("80002") in environment-aware application logic so staging and production hit the right chain.Este método não aceita parâmetros. Passe um array vazio [].
| Tipo | Descrição |
|---|---|
| string | Decimal string network ID, e.g. `"1"` for Ethereum mainnet. Note: network ID and chain ID coincide on most networks but can differ. |
Try it live in the Polygon playground.
eth_chainId, not this value."137"), not a hex value — unlike most numeric Polygon RPC responses, which return 0x-prefixed hex. Parse it as base-10.