net_version - GIWA
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 network ID as a decimal string. On GIWA the network ID matches the chain ID (91342) and is used to confirm which network an endpoint is connected to.
Parameters
Request
curl --location --request POST 'https://shared.ap-southeast-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": "getblock.io"
}'const axios = require('axios');
const response = await axios.post('https://shared.ap-southeast-1.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
method: 'net_version',
params: [],
id: 'getblock.io'
}, {
headers: { 'Content-Type': 'application/json' }
});
console.log(response.data.result);import requests
response = requests.post(
'https://shared.ap-southeast-1.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'net_version',
'params': [],
'id': 'getblock.io'
}
)
print(response.json())Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": "91342"
}Response Parameters
jsonrpc
string
JSON-RPC protocol version ("2.0")
id
string
Request identifier matching the request
result
string
Network ID as a decimal string (91342 for GIWA)
Use Cases
Network Confirmation: Verify a wallet or dApp is pointed at GIWA and not another chain
Environment Guards: Reject transactions when the connected network ID is unexpected
Multi-Chain Routing: Select the correct contract addresses based on the returned network ID
Connection Checks: Confirm an endpoint responds before issuing heavier calls
Error Handling
-32603
Internal error
The node failed to return the network ID
-32601
Method not found
The net module is disabled on the client build
Web3 Integration
Last updated
Was this helpful?