net_version

Returns the current network id.

📘

Supported on Avalanche C-Chain (mainnet) only.

Parameters

  • none

Returns

  • result - string - Returns the current network id.
    The full list of current network IDs is available at chainlist.org. Some common ones are: 1: Ethereum Mainnet 2: Morden testnet (now deprecated) 3: Ropsten testnet 4: Rinkeby testnet 5: Goerli testnet

API Endpoint

The format of an Avalanche C-Chain API endpoint is
https://open-platform.nodereal.io/{{apiKey}}/avalanche-c/ext/bc/C/rpc - for RPC API
https://open-platform.nodereal.io/{{apiKey}}/avalanche-c/ext/bc/C/avax - for AVAX API

Here is an example:
https://open-platform.nodereal.io/4c0a1c23661a4e26bcbcwed461e34ea9/avalanche-c/ext/bc/C/rpc
https://open-platform.nodereal.io/4c0a1c23661a4e26bcbcwed461e34ea9/avalanche-c/ext/bc/C/avax

Example

Request

curl --location --request POST https://open-platform.nodereal.io/{{apiKey}}/avalanche-c/ext/bc/C/rpc \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "net_version",
    "params": [],
    "id": 1
}'

Result

{
  "id":1,
  "jsonrpc": "2.0",
  "result": "43114"
}