Parameters
- transactionobject
The transaction call object:
- fromstring
The address from which the transaction is sent
- tostringREQUIRED
The address to which the transaction is addressed
- gasstring
The integer of gas provided for the transaction execution encoded as hexadecimal
- gasPricestring
The integer of gasPrice used for each paid gas encoded as hexadecimal
- valuestring
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
- quantitystring
The estimated amount of gas used
Request
1curl -X POST "https://docs-demo.elysium-mainnet.quiknode.pro/" \2-H "Content-Type: application/json" \3-d '{4"jsonrpc": "2.0",5"method": "eth_estimateGas",6"params": [7{8"to": "0x0000000000000000000000000000000000000001",9"data": "0x"10}11],12"id": 113}'
1curl -X POST "https://docs-demo.elysium-mainnet.quiknode.pro/" \2-H "Content-Type: application/json" \3-d '{4"jsonrpc": "2.0",5"method": "eth_estimateGas",6"params": [7{8"to": "0x0000000000000000000000000000000000000001",9"data": "0x"10}11],12"id": 113}'
1import { ethers } from "ethers";23async function main() {4const provider = new ethers.JsonRpcProvider("https://docs-demo.elysium-mainnet.quiknode.pro/");5const response = await provider.send("eth_estimateGas", [6{7"to": "0x0000000000000000000000000000000000000001",8"data": "0x"9}10]);11console.log(response);12}1314main();
1import { ethers } from "ethers";23async function main() {4const provider = new ethers.JsonRpcProvider("https://docs-demo.elysium-mainnet.quiknode.pro/");5const response = await provider.send("eth_estimateGas", [6{7"to": "0x0000000000000000000000000000000000000001",8"data": "0x"9}10]);11console.log(response);12}1314main();
1import json2from web3 import Web3, HTTPProvider3w3 = Web3(HTTPProvider('https://docs-demo.elysium-mainnet.quiknode.pro/'))4response = w3.provider.make_request("eth_estimateGas", [{"to":"0x0000000000000000000000000000000000000001","data":"0x"}])5print(response)
1import json2from web3 import Web3, HTTPProvider3w3 = Web3(HTTPProvider('https://docs-demo.elysium-mainnet.quiknode.pro/'))4response = w3.provider.make_request("eth_estimateGas", [{"to":"0x0000000000000000000000000000000000000001","data":"0x"}])5print(response)
1import { createPublicClient, http } from 'viem'23async function main() {4const client = createPublicClient({5transport: http('https://docs-demo.elysium-mainnet.quiknode.pro/')6})78const result = await client.request({9method: 'eth_estimateGas',10params: [11{12"to": "0x0000000000000000000000000000000000000001",13"data": "0x"14}15]16})1718console.log(result)19}2021main()
1import { createPublicClient, http } from 'viem'23async function main() {4const client = createPublicClient({5transport: http('https://docs-demo.elysium-mainnet.quiknode.pro/')6})78const result = await client.request({9method: 'eth_estimateGas',10params: [11{12"to": "0x0000000000000000000000000000000000000001",13"data": "0x"14}15]16})1718console.log(result)19}2021main()
1const body = {2jsonrpc: '2.0',3method: 'eth_estimateGas',4params: [{"to":"0x0000000000000000000000000000000000000001","data":"0x"}],5id: 16}78async function main() {9const response = await fetch('https://docs-demo.elysium-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: [{"to":"0x0000000000000000000000000000000000000001","data":"0x"}],5id: 16}78async function main() {9const response = await fetch('https://docs-demo.elysium-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.elysium-mainnet.quiknode.pro/"56payload = json.dumps(json.loads("{\"jsonrpc\":\"2.0\",\"method\":\"eth_estimateGas\",\"params\":[{\"to\":\"0x0000000000000000000000000000000000000001\",\"data\":\"0x\"}],\"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.elysium-mainnet.quiknode.pro/"56payload = json.dumps(json.loads("{\"jsonrpc\":\"2.0\",\"method\":\"eth_estimateGas\",\"params\":[{\"to\":\"0x0000000000000000000000000000000000000001\",\"data\":\"0x\"}],\"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.elysium-mainnet.quiknode.pro/")67payload = {8jsonrpc: "2.0",9id: 1,10method: "eth_estimateGas",11params: [{"to":"0x0000000000000000000000000000000000000001","data":"0x"}]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.elysium-mainnet.quiknode.pro/")67payload = {8jsonrpc: "2.0",9id: 1,10method: "eth_estimateGas",11params: [{"to":"0x0000000000000000000000000000000000000001","data":"0x"}]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": "0x5f12"5}
1{2"jsonrpc": "2.0",3"id": 1,4"result": "0x5f12"5}
Don't have an account yet?
Create your Quicknode endpoint in seconds and start building
Get started for free