curl --request POST \
--url https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800/ \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "net_version",
"params": []
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}curl --request POST \
--url https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800/ \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "net_version",
"params": []
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}noneresult — a string representing the current network ID.net_version code examplesconst { ethers } = require("ethers");
const provider = new ethers.JsonRpcProvider("CHAINSTACK_NODE_URL");
async function getNetworkVersion() {
const networkVersion = await provider.send("net_version", []);
console.log(`Network ID: ${networkVersion}`);
}
getNetworkVersion();
net_version is validating that your application is connected to the expected network before sending transactions, preventing accidental transactions on the wrong network.Was this page helpful?