BNB Smart Chain
BNB Smart Chain
net_version
The net_version method returns the current network ID as a string. This allows applications to determine which Ethereum network the client is connected to, such as mainnet, testnets, or other EVM-compatible networks.
Use Cases
- Network verification before sending transactions
- Cross-chain compatibility checks in multi-chain applications
- Environment-specific functionality for dApps
- Security validations to prevent sending to wrong networks
- Multi-network dApp development and testing
- Preventing accidental testnet vs mainnet operations
- Smart contract deployment verification
- Wallet network switching confirmation
- Transaction validation safety checks
- Network-specific feature enablement
Method Details
This method requires no parameters and returns a string value representing the network ID.
Response Example
Common Network IDs
| Network ID | Network Name |
|---|---|
| "1" | Ethereum Mainnet |
| "5" | Goerli Testnet |
| "11155111" | Sepolia Testnet |
| "10" | Optimism Mainnet |
| "42161" | Arbitrum One |
| "42170" | Arbitrum Nova |
| "137" | Polygon Mainnet |
| "80001" | Polygon Mumbai Testnet |
| "56" | BNB Smart Chain Mainnet |
| "97" | BNB Smart Chain Testnet |
| "43114" | Avalanche C-Chain |
| "250" | Fantom Opera |
| "100" | Gnosis Chain (formerly xDai) |
| "1284" | Moonbeam |
| "1285" | Moonriver |
| "324" | zkSync Era Mainnet |
| "59144" | Linea Mainnet |
| "8453" | Base Mainnet |
| "84531" | Base Goerli Testnet |
| "534352" | Scroll Mainnet |
| "7777777" | Zora Mainnet |
Important Notes
- Network ID is returned as a string, not a number
- Network ID is sometimes the same as Chain ID, but not always
- Some networks may change their network ID over time
- Always verify network ID when developing cross-chain applications
- For security-critical applications, consider using multiple verification methods
- EIP-155 introduced Chain ID for replay protection, which is different from Network ID in some cases
- For transaction signing, Chain ID (from
eth_chainId) is usually more relevant than Network ID
Difference Between Network ID and Chain ID
- Network ID: Identifies the network in the P2P protocol
- Chain ID: Used for transaction signing to prevent replay attacks
- For most networks, they are the same value, but there are exceptions
- Always use the appropriate ID for the specific use case
See also
- eth_chainId - Returns the chain ID used for transaction signing
- net_listening - Returns whether the client is actively networking
- net_peerCount - Returns the number of connected peers