eth_estimateGas RPC Method
To use the eth_estimateGas method on the C-Chain, ensure that the end of your URL includes ext/bc/C/rpc.
Parameters
transaction
object
Loading...
from
string
Loading...
to
string
REQUIRED
Loading...
gas
integer
Loading...
gasPrice
integer
Loading...
value
integer
Loading...
data
string
Loading...
blockNumber
string
Loading...
Returns
quantity
string
Loading...
Request
1curl -X POST "https://docs-demo.flare-mainnet.quiknode.pro/ext/bc/C/rpc/" \2-H "Content-Type: application/json" \3-d '{4"jsonrpc": "2.0",5"method": "eth_estimateGas",6"params": [7{8"from": "0x7Ac6d25FD5E437cB7c57Aee77aC2d0A6Cb85936C",9"to": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",10"value": "0x186a0"11},12"latest"13],14"id": 115}'
1curl -X POST "https://docs-demo.flare-mainnet.quiknode.pro/ext/bc/C/rpc/" \2-H "Content-Type: application/json" \3-d '{4"jsonrpc": "2.0",5"method": "eth_estimateGas",6"params": [7{8"from": "0x7Ac6d25FD5E437cB7c57Aee77aC2d0A6Cb85936C",9"to": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",10"value": "0x186a0"11},12"latest"13],14"id": 115}'
1const body = {2jsonrpc: '2.0',3method: 'eth_estimateGas',4params: [{"from":"0x7Ac6d25FD5E437cB7c57Aee77aC2d0A6Cb85936C","to":"0xd3CdA913deB6f67967B99D67aCDFa1712C293601","value":"0x186a0"},"latest"],5id: 16}78async function main() {9const response = await fetch('https://docs-demo.flare-mainnet.quiknode.pro/ext/bc/C/rpc/', {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":"0x7Ac6d25FD5E437cB7c57Aee77aC2d0A6Cb85936C","to":"0xd3CdA913deB6f67967B99D67aCDFa1712C293601","value":"0x186a0"},"latest"],5id: 16}78async function main() {9const response = await fetch('https://docs-demo.flare-mainnet.quiknode.pro/ext/bc/C/rpc/', {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.flare-mainnet.quiknode.pro/ext/bc/C/rpc/"56payload = json.dumps({7"jsonrpc": "2.0",8"method": "eth_estimateGas",9"params": [10{11"from": "0x7Ac6d25FD5E437cB7c57Aee77aC2d0A6Cb85936C",12"to": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",13"value": "0x186a0"14},15"latest"16],17"id": 118})19headers = {20'Content-Type': 'application/json'21}2223response = requests.request("POST", url, headers=headers, data=payload)2425print(response.text)
1import requests2import json34url = "https://docs-demo.flare-mainnet.quiknode.pro/ext/bc/C/rpc/"56payload = json.dumps({7"jsonrpc": "2.0",8"method": "eth_estimateGas",9"params": [10{11"from": "0x7Ac6d25FD5E437cB7c57Aee77aC2d0A6Cb85936C",12"to": "0xd3CdA913deB6f67967B99D67aCDFa1712C293601",13"value": "0x186a0"14},15"latest"16],17"id": 118})19headers = {20'Content-Type': 'application/json'21}2223response = requests.request("POST", url, headers=headers, data=payload)2425print(response.text)
1require "uri"2require "json"3require "net/http"45uri = URI("https://docs-demo.flare-mainnet.quiknode.pro/ext/bc/C/rpc/")67payload = {8jsonrpc: "2.0",9id: 1,10method: "eth_estimateGas",11params: [{"from":"0x7Ac6d25FD5E437cB7c57Aee77aC2d0A6Cb85936C","to":"0xd3CdA913deB6f67967B99D67aCDFa1712C293601","value":"0x186a0"},"latest"]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.flare-mainnet.quiknode.pro/ext/bc/C/rpc/")67payload = {8jsonrpc: "2.0",9id: 1,10method: "eth_estimateGas",11params: [{"from":"0x7Ac6d25FD5E437cB7c57Aee77aC2d0A6Cb85936C","to":"0xd3CdA913deB6f67967B99D67aCDFa1712C293601","value":"0x186a0"},"latest"]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