Skip to main content

net_version

POST

Returns the network ID of the connected Ethereum network. The network ID is used to distinguish between different Ethereum networks (e.g., mainnet, testnet). For example, Ethereum mainnet has network ID 1, Ropsten testnet has 3, and Rinkeby testnet has 4. This method is primarily used to identify the network and verify that an application is connected to the correct network.
Path Parameters
chainstringrequired
Parameter specifying the target chain to query.
networkstringrequired
Parameter specifying the network of the target chain.
Responses
codestringrequired
Code identifying the cause of the failed request.
messagestringrequired
Detailed message including the name and value of the invalid parameter.
{
"code": "ERROR_CODE",
"message": "Unauthorized"
}
cURL
curl -X POST 'https://ethereum-mainnet.nodit.io' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: nodit-demo' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "net_version",
"params": []
}'