Ethereum

Ethereum

net_version

net_version returns the network ID of the chain a node is connected to, given as a plain decimal string. For Ethereum mainnet the answer is "1" — the same value as chain ID 1, since the two coincide on Ethereum even though they are distinct concepts at the protocol level. It is a quick way to confirm you are talking to the right ETH network before you do anything that matters. Point the call at https://ethereum.therpc.io/YOUR_API_KEY and you will get "1" back; a Sepolia endpoint would answer "11155111", Holesky "17000". The method takes no parameters and reads no state.

Use cases

  • Confirm a wallet or dApp is pointed at Ethereum mainnet ("1") before broadcasting a transaction that moves real ETH.
  • Branch application logic by environment, telling mainnet apart from Sepolia ("11155111") or Holesky ("17000") so staging never writes to production state.

Parameters

This method takes no parameters. Pass an empty array [].

Response

TypeDescription
stringDecimal string network ID, e.g. `"1"` for Ethereum mainnet. Note: network ID and chain ID coincide on most networks but can differ.

Example request

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": 1
}'

Try it live in the Ethereum playground.

Errors & troubleshooting

Common pitfalls

  • Network ID and chain ID happen to match on Ethereum mainnet (both 1), but they are not the same field, and on some networks they diverge. For anything that signs a transaction, use eth_chainId, since EIP-155 replay protection is keyed on the chain ID, not the network ID.
  • The return is a decimal string, not the 0x-prefixed hex you see almost everywhere else in the JSON-RPC API. Parse it as base 10, and do not feed it to a hex decoder expecting "0x1".

Supported networks

  • Mainnet — Chain ID: 1
  • Sepolia — Chain ID: 11155111

See also

curl https://ethereum.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"net_version","params":[]}'

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.