Polygon
Polygon
Polygon
免费套餐涵盖个人项目。按量付费,无需绑卡即可扩展。
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.此方法不需要任何参数,传入空数组 [] 即可。
| 类型 | 描述 |
|---|---|
| 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.