Parameters
- transactionobjectREQUIRED
The transaction call object:
- fromstring
The address from which the transaction is sent
- tostringREQUIRED
The address to which the transaction is addressed
- gasinteger
The integer of gas provided for the transaction execution
- gasPriceinteger
The integer of gasPrice used for each paid gas encoded as hexadecimal
- valueinteger
The integer of value sent with this transaction encoded as hexadecimal
- datastring
The hash of the method signature and encoded parameters. For more information, see the Contract ABI description in the Solidity documentation.
Returns
- resultstring
The estimated amount of gas used
Request
1curl -X POST "https://docs-demo.zero-mainnet.quiknode.pro/" \2-H "Content-Type: application/json" \3-d '{4"jsonrpc": "2.0",5"method": "eth_estimateGas",6"params": [7{8"from": "0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749",9"to": "0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749",10"value": "0x0"11}12],13"id": 114}'
1curl -X POST "https://docs-demo.zero-mainnet.quiknode.pro/" \2-H "Content-Type: application/json" \3-d '{4"jsonrpc": "2.0",5"method": "eth_estimateGas",6"params": [7{8"from": "0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749",9"to": "0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749",10"value": "0x0"11}12],13"id": 114}'
1import { ethers } from "ethers";23async function main() {4const provider = new ethers.JsonRpcProvider("https://docs-demo.zero-mainnet.quiknode.pro/");5const response = await provider.send("eth_estimateGas", [6{7"from": "0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749",8"to": "0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749",9"value": "0x0"10}11]);12console.log(response);13}1415main();
1import { ethers } from "ethers";23async function main() {4const provider = new ethers.JsonRpcProvider("https://docs-demo.zero-mainnet.quiknode.pro/");5const response = await provider.send("eth_estimateGas", [6{7"from": "0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749",8"to": "0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749",9"value": "0x0"10}11]);12console.log(response);13}1415main();
1import json2from web3 import Web3, HTTPProvider3w3 = Web3(HTTPProvider('https://docs-demo.zero-mainnet.quiknode.pro/'))4response = w3.provider.make_request("eth_estimateGas", [{"from":"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749","to":"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749","value":"0x0"}])5print(response)
1import json2from web3 import Web3, HTTPProvider3w3 = Web3(HTTPProvider('https://docs-demo.zero-mainnet.quiknode.pro/'))4response = w3.provider.make_request("eth_estimateGas", [{"from":"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749","to":"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749","value":"0x0"}])5print(response)
1import { createPublicClient, http } from 'viem'23async function main() {4const client = createPublicClient({5transport: http('https://docs-demo.zero-mainnet.quiknode.pro/')6})78const result = await client.request({9method: 'eth_estimateGas',10params: [11{12"from": "0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749",13"to": "0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749",14"value": "0x0"15}16]17})1819console.log(result)20}2122main()
1import { createPublicClient, http } from 'viem'23async function main() {4const client = createPublicClient({5transport: http('https://docs-demo.zero-mainnet.quiknode.pro/')6})78const result = await client.request({9method: 'eth_estimateGas',10params: [11{12"from": "0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749",13"to": "0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749",14"value": "0x0"15}16]17})1819console.log(result)20}2122main()
1const body = {2jsonrpc: '2.0',3method: 'eth_estimateGas',4params: [{"from":"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749","to":"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749","value":"0x0"}],5id: 16}78async function main() {9const response = await fetch('https://docs-demo.zero-mainnet.quiknode.pro/', {10method: 'POST',11headers: {'Content-Type': 'application/json'},12body: JSON.stringify(body)13})14const data = await response.json()15console.log(data)16}1718main()
1const body = {2jsonrpc: '2.0',3method: 'eth_estimateGas',4params: [{"from":"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749","to":"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749","value":"0x0"}],5id: 16}78async function main() {9const response = await fetch('https://docs-demo.zero-mainnet.quiknode.pro/', {10method: 'POST',11headers: {'Content-Type': 'application/json'},12body: JSON.stringify(body)13})14const data = await response.json()15console.log(data)16}1718main()
1import requests2import json34url = "https://docs-demo.zero-mainnet.quiknode.pro/"56payload = json.dumps(json.loads("{\"jsonrpc\":\"2.0\",\"method\":\"eth_estimateGas\",\"params\":[{\"from\":\"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749\",\"to\":\"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749\",\"value\":\"0x0\"}],\"id\":1}"))7headers = {8'Content-Type': 'application/json'9}1011response = requests.request("POST", url, headers=headers, data=payload)1213print(response.text)
1import requests2import json34url = "https://docs-demo.zero-mainnet.quiknode.pro/"56payload = json.dumps(json.loads("{\"jsonrpc\":\"2.0\",\"method\":\"eth_estimateGas\",\"params\":[{\"from\":\"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749\",\"to\":\"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749\",\"value\":\"0x0\"}],\"id\":1}"))7headers = {8'Content-Type': 'application/json'9}1011response = requests.request("POST", url, headers=headers, data=payload)1213print(response.text)
1require "uri"2require "json"3require "net/http"45uri = URI("https://docs-demo.zero-mainnet.quiknode.pro/")67payload = {8jsonrpc: "2.0",9id: 1,10method: "eth_estimateGas",11params: [{"from":"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749","to":"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749","value":"0x0"}]12}1314request = Net::HTTP::Post.new(uri)15request["Content-Type"] = "application/json"16request.body = JSON.generate(payload)1718response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|19http.request(request)20end2122puts response.body
1require "uri"2require "json"3require "net/http"45uri = URI("https://docs-demo.zero-mainnet.quiknode.pro/")67payload = {8jsonrpc: "2.0",9id: 1,10method: "eth_estimateGas",11params: [{"from":"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749","to":"0x339d413CCEfD986b1B3647A9cfa9CBbE70A30749","value":"0x0"}]12}1314request = Net::HTTP::Post.new(uri)15request["Content-Type"] = "application/json"16request.body = JSON.generate(payload)1718response = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|19http.request(request)20end2122puts response.body
Response
1{2"jsonrpc": "2.0",3"id": 1,4"result": "0x5208"5}
1{2"jsonrpc": "2.0",3"id": 1,4"result": "0x5208"5}
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free