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.
- blockNumberstring
The block number in hexadecimal format or the string latest, earliest, pending, safe or finalized
Returns
- quantitystring
The estimated amount of gas used
Request
1curl https://docs-demo.kaia-kairos.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4-H "x-token: AUTH_TOKEN" \5--data '{"method":"eth_estimateGas","params":[{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"}],"id":1,"jsonrpc":"2.0"}'
1curl https://docs-demo.kaia-kairos.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4-H "x-token: AUTH_TOKEN" \5--data '{"method":"eth_estimateGas","params":[{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"}],"id":1,"jsonrpc":"2.0"}'
1require 'eth'23client = Eth::Client.create 'https://docs-demo.kaia-kairos.quiknode.pro/'4payload = {5"jsonrpc": "2.0",6"method": "eth_estimateGas",7"params": [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"}],8"id": "1"9}1011response = client.send(payload.to_json)12puts response
1require 'eth'23client = Eth::Client.create 'https://docs-demo.kaia-kairos.quiknode.pro/'4payload = {5"jsonrpc": "2.0",6"method": "eth_estimateGas",7"params": [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"}],8"id": "1"9}1011response = client.send(payload.to_json)12puts response
1import { ethers } from "ethers";2(async () => {3const request = new ethers.FetchRequest("https://docs-demo.kaia-kairos.quiknode.pro/");4request.setHeader("x-token", "AUTH_TOKEN");5const provider = new ethers.JsonRpcProvider(request);6const response = await provider.estimateGas({7"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",8"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",9});10console.log(response);11})();
1import { ethers } from "ethers";2(async () => {3const request = new ethers.FetchRequest("https://docs-demo.kaia-kairos.quiknode.pro/");4request.setHeader("x-token", "AUTH_TOKEN");5const provider = new ethers.JsonRpcProvider(request);6const response = await provider.estimateGas({7"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",8"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",9});10console.log(response);11})();
1var myHeaders = new Headers();2myHeaders.append("x-token", "AUTH_TOKEN");3myHeaders.append("Content-Type", "application/json");45var raw = JSON.stringify({6"method": "eth_estimateGas",7"params": [8{9"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",10"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"11}12],13"id": 1,14"jsonrpc": "2.0"15});1617var requestOptions = {18method: 'POST',19headers: myHeaders,20body: raw,21redirect: 'follow'22};2324fetch("https://docs-demo.kaia-kairos.quiknode.pro/", requestOptions)25.then(response => response.text())26.then(result => console.log(result))27.catch(error => console.log('error', error));
1var myHeaders = new Headers();2myHeaders.append("x-token", "AUTH_TOKEN");3myHeaders.append("Content-Type", "application/json");45var raw = JSON.stringify({6"method": "eth_estimateGas",7"params": [8{9"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",10"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"11}12],13"id": 1,14"jsonrpc": "2.0"15});1617var requestOptions = {18method: 'POST',19headers: myHeaders,20body: raw,21redirect: 'follow'22};2324fetch("https://docs-demo.kaia-kairos.quiknode.pro/", requestOptions)25.then(response => response.text())26.then(result => console.log(result))27.catch(error => console.log('error', error));
1import requests2import json34url = "https://docs-demo.kaia-kairos.quiknode.pro/"56payload = json.dumps({7"method": "eth_estimateGas",8"params": [9{10"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",11"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"12}13],14"id": 1,15"jsonrpc": "2.0"16})17headers = {18'x-token': 'AUTH_TOKEN',19'Content-Type': 'application/json'20}2122response = requests.request("POST", url, headers=headers, data=payload)2324print(response.text)25
1import requests2import json34url = "https://docs-demo.kaia-kairos.quiknode.pro/"56payload = json.dumps({7"method": "eth_estimateGas",8"params": [9{10"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",11"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"12}13],14"id": 1,15"jsonrpc": "2.0"16})17headers = {18'x-token': 'AUTH_TOKEN',19'Content-Type': 'application/json'20}2122response = requests.request("POST", url, headers=headers, data=payload)2324print(response.text)25
1require "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.kaia-kairos.quiknode.pro/")67https = Net::HTTP.new(url.host, url.port)8https.use_ssl = true910request = Net::HTTP::Post.new(url)11request["x-token"] = "AUTH_TOKEN"12request["Content-Type"] = "application/json"13request.body = JSON.dump({14"method": "eth_estimateGas",15"params": [16{17"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",18"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"19}20],21"id": 1,22"jsonrpc": "2.0"23})2425response = https.request(request)26puts response.read_body27
1require "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.kaia-kairos.quiknode.pro/")67https = Net::HTTP.new(url.host, url.port)8https.use_ssl = true910request = Net::HTTP::Post.new(url)11request["x-token"] = "AUTH_TOKEN"12request["Content-Type"] = "application/json"13request.body = JSON.dump({14"method": "eth_estimateGas",15"params": [16{17"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",18"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"19}20],21"id": 1,22"jsonrpc": "2.0"23})2425response = https.request(request)26puts response.read_body27
1from web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.kaia-kairos.quiknode.pro/', request_kwargs={'headers': {'x-token': 'AUTH_TOKEN'}}))3estimate = w3.eth.estimate_gas({"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"})4print(estimate)
1from web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.kaia-kairos.quiknode.pro/', request_kwargs={'headers': {'x-token': 'AUTH_TOKEN'}}))3estimate = w3.eth.estimate_gas({"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"})4print(estimate)
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free