net_version
Returns the current network ID. This is usually equivalent to the chainID, but may differ from it for some legacy networks or special testnets.
Ethereum specification · All supported methods
Parameters
No parameters. Send an empty params array.
Return value
The selected network’s ID as a decimal string.
Example
Replace <gateway-url> with your gateway base URL and <service-url> with the chain’s service path, such as service/ethereum.
sh
curl -X POST "<gateway-url>/<service-url>" \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","id":1,"method":"net_version","params":[]}'Illustrative response; values depend on the selected network and request:
json
{
"jsonrpc": "2.0",
"id": 1,
"result": "1"
}Direct behavior
Returns the network ID for the selected network. Its decimal string is not necessarily the same value or encoding as eth_chainId.