Join AWS, Dust Labs & OrangeDAO at QuickPitch. Win $80k — Apply Today.

Contents

net_version RPC Method

The API credit value for this method is 1 . To learn more about API credits and each method's value, visit the API Credits page.

Parameters:

  1. none

Returns:

  1. result - The string value of current network id. Typical values are as follows:
    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

Code Examples:

require "uri"
require "json"
require "net/http"

url = URI("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/")

https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "jsonrpc": "2.0",
  "method": "net_version",
  "params": [],
  "id": 67
})

response = https.request(request)
puts response.read_body
Ready to get started? Create a free account