net_version

Returns the current network id.

Parameters:

None

Returns:

String - The current network id.

The full list of current network IDs is available at chainlist.org(opens in a new tab)↗. Some common ones are:

  • 1: Ethereum Mainnet

  • 5: Goerli testnet

  • 11155111: Sepolia testnet

Code Examples:

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "jsonrpc": "2.0",
  "method": "net_version",
  "params": [],
  "id": 67
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.ebs.ezat.io/core/api/v1.0/rpc/aurora/mainnet?x-api-key-id=API-KEY-ID&x-api-key=API-KEY", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

// Result
{
  "id":67,
  "jsonrpc": "2.0",
  "result": "3"
}

Last updated