net_version - Base

Example code for the net_version JSON-RPC method. Complete guide on how to use net_version JSON-RPC in GetBlock Web3 documentation.

The net_version method returns the current network ID. For Base mainnet, this returns "8453". This method is primarily used for legacy compatibility, as eth_chainId is the preferred method for modern applications.

Parameters

  • None

Request

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "net_version",
    "params": [],
    "id": "getblock.io"
}'

Response

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "8453"
}

Response Parameters

Parameter
Type
Description

jsonrpc

string

JSON-RPC protocol version ("2.0")

id

string

Request identifier matching the request

result

string

Network ID as a decimal string

Use Cases

  • Network Verification: Confirm connection to expected network

  • Legacy Compatibility: Support older wallet integrations

  • Multi-network Apps: Route connections to correct network

  • Configuration Validation: Verify RPC endpoint configuration

Error Handling

Error Code
Message
Description

-32603

Internal error

Node internal failure

Web3 Integration

Last updated

Was this helpful?