githubEdit

net_version - Celo

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

This method returns the current network ID of the Celo node.

Parameters

  • None

Request Example

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

Response Example

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

Response Definition

Field
Type
Description

result

string

Network ID as a decimal string

Use Cases

  • Verify connection to correct network

  • Distinguish mainnet from testnet

  • Network detection in multi-chain apps

Error Handling

Error Code
Description

-32603

Internal error

SDK Integration

Last updated

Was this helpful?