For the complete documentation index, see llms.txt. This page is also available as Markdown.

net_version

Returns the current network id.

Parameters​

None

Return Type​

ChainId - The current network id. The full list of chain IDs is available at chainlist.org. Some of the common ones are noted bellow.

ChainId

type ChainId =
  | "1" // Ethereum Mainnet
  | "2" // Morden Testnet (deprecated)
  | "3" // Ropsten Testnet
  | "4" // Rinkeby Testnet
  | "5" // Goerli Testnet
  | "11155111"; // Sepolia TestNet

Example​

await provider.request({ method: "net_version", params: [] });
// "3"

Last updated

Was this helpful?