Chain ID vs network ID: eth_chainId vs net_version
Last updated:
At a glance
| Property | Value |
|---|---|
| eth_chainId | EIP-155 chain ID as a hex quantity, e.g. "0x1" |
| net_version | Network ID as a decimal string, e.g. "1" |
| Used in transaction signing | Chain ID (EIP-155 replay protection) |
| Example where they differ | Ethereum Classic: chain ID 61, network ID 1 |
| Chain IDs of common networks | Ethereum 1, BNB Smart Chain 56, Polygon PoS 137, Base 8453 |
What you see
eth_chainId returns "0x1" while net_version returns "1"; on another chain the two values do not match at all. Code that compares one against a config value built from the other rejects a valid endpoint, or signs for the wrong chain.
Why this happens
EIP-155 added the chain ID to the data that is signed in a transaction, so a transaction signed for one chain is invalid on any chain with a different ID. EIP-695 then added eth_chainId because, until then, clients could only query the network ID with net_version — a separate number used by nodes to find peers of the same network — and the two are not guaranteed to be the same. Ethereum Classic is the classic example: its chain ID is 61 (0x3d, the example in EIP-695) while it kept network ID 1. The formats differ too: eth_chainId returns a hex quantity, net_version a decimal string. EIP-695 is explicit that consumers should prefer eth_chainId to reliably identify the chain they are talking to.
What to do
- Identify the chain with eth_chainId and compare it as a number (parse the hex), not as a string.
- Use the chain ID from eth_chainId, not net_version, when building and signing transactions.
- Check the value against a public registry of chain IDs (for example Ethereum 1, BNB Smart Chain 56, Polygon PoS 137, Base 8453) before trusting a new endpoint.
- Keep net_version only for tooling that explicitly needs the network ID.
When this is not our problem
Both numbers are defined by the chain, not by the RPC provider, and every node returns the chain's own values, whoever operates it, Triport included. A mismatch between them is expected on some chains and is not an endpoint fault.
FAQ
- Is chain ID the same as network ID?
- Not necessarily. The chain ID is used in transaction signing (EIP-155); the network ID is used for peer-to-peer networking. They are equal on many chains but differ on some, such as Ethereum Classic.
- Should I use eth_chainId or net_version?
- eth_chainId. EIP-695 states that consumers should prefer it over net_version to reliably identify the chain.