Docs
Docs
Home
Getting Started
Agent Tooling
CLI
Supported Chains
Acala
Aptos
Arbitrum
Arc
Asset Hub
Astar
Avalanche
Base
Berachain
Bifrost
Binance Smart Chain
Bittensor
Blast
Boba Network
Bridge Hub
Celo
Centrifuge
Chiliz
Cronos
Enjin
Ethereum
Etherlink
Flow EVM Gateway
Gnosis
Hydration
Hyperliquid
Immutable
Ink
IoTeX
Kusama
Linea
LISK
Manta Atlantic
Manta Pacific
Mantle
MegaETH
Monad
Movement
Neuroweb
opBNB
Optimism
Plasma
Polkadot
Polygon
Pulsechain
Robinhood
Ronin
Scroll
Sonic
Starknet
Taiko
Tempo
Sui
TRON
Unichain
Viction
World Chain
XDC Network
XX Network
Zetachain
zkSync Era
Zora
Supported ChainsPlasmaJSON-RPC APINetwork Methods

net_version - Plasma RPC Method

Get the current network ID on Plasma. Useful for endpoint identification and multi-network routing.

Plasma RPC endpoint: endpoint URLs, plans and pricing.

Returns the current network ID on Plasma as a decimal string. The network ID identifies which network the node is connected to.

Why Plasma? Build on an EVM Layer 1 for stablecoin payments with PlasmaBFT consensus and Reth execution with 1 second blocks, XPL gas, full EVM JSON-RPC, and debug plus txpool on Dwellir.

When to Use This Method

net_version is essential for payment app developers, wallet teams, and teams shipping Solidity contracts for dollar transfers:

  • Endpoint Identification - Confirm your application is connected to the expected Plasma network
  • Multi-Chain App Routing - Dynamically detect which network an RPC endpoint serves and route logic accordingly
  • Connection Validation - Perform a quick sanity check during node or provider initialization
JSON-RPC request
{
  "jsonrpc": "2.0",
  "method": "net_version",
  "params": [],
  "id": 1
}

Code Examples

Common Use Cases

1. Multi-Chain Connection Validator

Verify your application connects to the expected network before processing any transactions:

JavaScript
const EXPECTED_NETWORKS = {
  '1': 'Ethereum Mainnet',
  '137': 'Polygon',
  '42161': 'Arbitrum One',
  '10': 'Optimism',
};

async function validateNetwork(provider, expectedNetworkId) {
  const networkId = await provider.send('net_version', []);

  if (networkId !== expectedNetworkId) {
    const actual = EXPECTED_NETWORKS[networkId] || `Unknown (${networkId})`;
    const expected = EXPECTED_NETWORKS[expectedNetworkId] || expectedNetworkId;
    throw new Error(`Wrong network: connected to ${actual}, expected ${expected}`);
  }

  console.log(`Connected to ${EXPECTED_NETWORKS[networkId]}`);
  return networkId;
}

2. Dynamic Chain Router

Route application logic based on the detected network:

JavaScript
async function createChainRouter(rpcUrl) {
  const provider = new JsonRpcProvider(rpcUrl);
  const networkId = await provider.send('net_version', []);

  const config = {
    '1': { explorer: 'https://etherscan.io', confirmations: 12 },
    '137': { explorer: 'https://polygonscan.com', confirmations: 128 },
    '42161': { explorer: 'https://arbiscan.io', confirmations: 1 },
  };

  if (!config[networkId]) {
    throw new Error(`Unsupported network ID: ${networkId}`);
  }

  return { provider, networkId, ...config[networkId] };
}

3. Network ID vs Chain ID Comparison

Compare net_version with eth_chainId when you need both endpoint identity and signing context:

Python
from web3 import Web3

def verify_chain_identity(rpc_url):
    w3 = Web3(Web3.HTTPProvider(rpc_url))

    network_id = int(w3.net.version)
    chain_id = w3.eth.chain_id

    if network_id != chain_id:
        print(f'Network ID ({network_id}) differs from chain ID ({chain_id})')
    else:
        print(f'Network and chain ID match: {chain_id}')

    print('Use eth_chainId as the signing source of truth')

    return {'network_id': network_id, 'chain_id': chain_id}

Best Practices

  • Use eth_chainId for transaction signing (EIP-155 replay protection) -- net_version is for network identification only
  • Cache the network ID at startup -- it does not change during a session
  • Some L2 and sidechain networks share the same network ID as their L1 -- always combine with eth_chainId for unambiguous identification
  • For multi-chain dApps, maintain a mapping of network IDs to chain-specific contract addresses and RPC endpoints
  • The net_* namespace may be disabled on some node configurations -- handle the -32601 error gracefully

Error Handling

Error CodeDescriptionSolution
-32601Method not foundThe node may have the net namespace disabled -- check node startup flags
-32603Internal errorNode may be starting up -- retry after delay
-32005Rate limit exceededReduce polling frequency or implement backoff

Related Methods

  • eth_chainId - Get the EIP-155 chain ID (preferred for transaction signing)
  • net_listening - Check whether the client reports peer-listening state
  • net_peerCount - Get number of connected peers
  • eth_syncing - Check node sync progress

eth_syncing

Check the sync status of your Plasma node. Returns sync progress or false when fully synced - essential for node health monitoring and dApp reliability.

net_listening

Check the legacy net_listening compatibility method on Plasma. Public endpoints may return a boolean or an unsupported-method response depending on the client.

On this page

When to Use This MethodCode ExamplesCommon Use Cases1. Multi-Chain Connection Validator2. Dynamic Chain Router3. Network ID vs Chain ID ComparisonBest PracticesError HandlingRelated Methods