更新时间:2024-03-06 GMT+08:00

net_version

简介

返回当前网络id。该API所消耗的计算单元为107。

参数说明

此方法不接受任何参数。

返回值

Object - 当前网络id的字符串值。典型值如下:
  • 1 - ethereum mainnet
  • 2 - morden testnet (deprecated)
  • 3 - ropsten testnet
  • 4 - rinkeby testnet
  • 5 - goerli testnet
  • 11155111 - sepolia testnet
  • 10 - optimism mainnet
  • 69 - optimism kovan testnet
  • 42 - kovan testnet
  • 137 - matic/polygon mainnet
  • 80001 - matic/polygon mumbai testnet
  • 250 - fantom mainnet
  • 100 - xdai mainnet
  • 56 - bsc mainnet

请求样式

curl https://your-http-endpoint/v1/<API-KEY> \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"net_version","params":[],"id":1,"jsonrpc":"2.0"}'