eth_gasPrice RPC Method
Parameters
This method does not accept any parameters
Returns
result
string
Loading...
Request
1curl https://docs-demo.0g-mainnet.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4--data '{"method":"eth_gasPrice","params":[],"id":1,"jsonrpc":"2.0"}'
1curl https://docs-demo.0g-mainnet.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4--data '{"method":"eth_gasPrice","params":[],"id":1,"jsonrpc":"2.0"}'
1require 'eth'23client = Eth::Client.create 'https://docs-demo.0g-mainnet.quiknode.pro/'4payload = {5"jsonrpc": "2.0",6"method": "eth_gasPrice",7"params": [],8"id": "1"9}1011response = client.send(payload.to_json)12puts response
1require 'eth'23client = Eth::Client.create 'https://docs-demo.0g-mainnet.quiknode.pro/'4payload = {5"jsonrpc": "2.0",6"method": "eth_gasPrice",7"params": [],8"id": "1"9}1011response = client.send(payload.to_json)12puts response
1import { ethers } from "ethers";2(async () => {3const provider = new ethers.JsonRpcProvider("https://docs-demo.0g-mainnet.quiknode.pro/");4const response = (await provider.getFeeData()).gasPrice;5console.log(response);6})();
1import { ethers } from "ethers";2(async () => {3const provider = new ethers.JsonRpcProvider("https://docs-demo.0g-mainnet.quiknode.pro/");4const response = (await provider.getFeeData()).gasPrice;5console.log(response);6})();
1var myHeaders = new Headers();2myHeaders.append("Content-Type", "application/json");34var raw = JSON.stringify({5"method": "eth_gasPrice",6"params": [],7"id": 1,8"jsonrpc": "2.0"9});1011var requestOptions = {12method: 'POST',13headers: myHeaders,14body: raw,15redirect: 'follow'16};1718fetch("https://docs-demo.0g-mainnet.quiknode.pro/", requestOptions)19.then(response => response.text())20.then(result => console.log(result))21.catch(error => console.log('error', error));
1var myHeaders = new Headers();2myHeaders.append("Content-Type", "application/json");34var raw = JSON.stringify({5"method": "eth_gasPrice",6"params": [],7"id": 1,8"jsonrpc": "2.0"9});1011var requestOptions = {12method: 'POST',13headers: myHeaders,14body: raw,15redirect: 'follow'16};1718fetch("https://docs-demo.0g-mainnet.quiknode.pro/", requestOptions)19.then(response => response.text())20.then(result => console.log(result))21.catch(error => console.log('error', error));
1import requests2import json34url = "https://docs-demo.0g-mainnet.quiknode.pro/"56payload = json.dumps({7"method": "eth_gasPrice",8"params": [],9"id": 1,10"jsonrpc": "2.0"11})12headers = {13'Content-Type': 'application/json'14}1516response = requests.request("POST", url, headers=headers, data=payload)1718print(response.text)19
1import requests2import json34url = "https://docs-demo.0g-mainnet.quiknode.pro/"56payload = json.dumps({7"method": "eth_gasPrice",8"params": [],9"id": 1,10"jsonrpc": "2.0"11})12headers = {13'Content-Type': 'application/json'14}1516response = requests.request("POST", url, headers=headers, data=payload)1718print(response.text)19
1require "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.0g-mainnet.quiknode.pro/")67https = Net::HTTP.new(url.host, url.port)8https.use_ssl = true910request = Net::HTTP::Post.new(url)11request["Content-Type"] = "application/json"12request.body = JSON.dump({13"method": "eth_gasPrice",14"params": [],15"id": 1,16"jsonrpc": "2.0"17})1819response = https.request(request)20puts response.read_body21
1require "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.0g-mainnet.quiknode.pro/")67https = Net::HTTP.new(url.host, url.port)8https.use_ssl = true910request = Net::HTTP::Post.new(url)11request["Content-Type"] = "application/json"12request.body = JSON.dump({13"method": "eth_gasPrice",14"params": [],15"id": 1,16"jsonrpc": "2.0"17})1819response = https.request(request)20puts response.read_body21
1from web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.0g-mainnet.quiknode.pro/'))3print (w3.eth.gas_price)
1from web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.0g-mainnet.quiknode.pro/'))3print (w3.eth.gas_price)
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free