eth_estimateGas RPC Method
參數
transaction
物件
必填
載入中...
出自
字串
載入中...
至
字串
必填
載入中...
氣體
整數
載入中...
gasPrice
整數
載入中...
值
整數
載入中...
資料
字串
載入中...
退貨
quantity
字串
載入中...
請求
1curl https://docs-demo.hedera-testnet.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4--data '{"method":"eth_estimateGas","params":[{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"}],"id":1,"jsonrpc":"2.0"}'
1curl https://docs-demo.hedera-testnet.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4--data '{"method":"eth_estimateGas","params":[{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"}],"id":1,"jsonrpc":"2.0"}'
1require 'eth'23client = Eth::Client.create 'https://docs-demo.hedera-testnet.quiknode.pro/'4有效載荷 = {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.hedera-testnet.quiknode.pro/'4有效載荷 = {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 provider = new ethers.JsonRpcProvider("https://docs-demo.hedera-testnet.quiknode.pro/");4const response = await provider.estimateGas({5"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",6"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",7});8console.log(response);9})();
1import { ethers } from "ethers";2(async () => {3const provider = new ethers.JsonRpcProvider("https://docs-demo.hedera-testnet.quiknode.pro/");4const response = await provider.estimateGas({5"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",6"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",7});8console.log(response);9})();
1var myHeaders = new Headers();2myHeaders.追加("Content-Type", "application/json");34var 原始 = JSON.stringify({5"method": "eth_estimateGas",6"params": [7{8"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",9"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"10}11],12"id": 1,13"jsonrpc": "2.0"14});1516var requestOptions = {17方法: 'POST',18標題: myHeaders,19正文: 原始,20重定向: '追蹤'21};2223fetch("https://docs-demo.hedera-testnet.quiknode.pro/", requestOptions)24.接著(回應 => response.text())25.接著(結果 => 控制台.log(結果))26.catchcatch(錯誤 => console.log('error', error));
1var myHeaders = new Headers();2myHeaders.追加("Content-Type", "application/json");34var 原始 = JSON.stringify({5"method": "eth_estimateGas",6"params": [7{8"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",9"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"10}11],12"id": 1,13"jsonrpc": "2.0"14});1516var requestOptions = {17方法: 'POST',18標題: myHeaders,19正文: 原始,20重定向: '追蹤'21};2223fetch("https://docs-demo.hedera-testnet.quiknode.pro/", requestOptions)24.接著(回應 => response.text())25.接著(結果 => 控制台.log(結果))26.catchcatch(錯誤 => console.log('error', error));
1匯入 請求2匯入 json34url = "https://docs-demo.hedera-testnet.quiknode.pro/"56有效載荷 = 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})17標題 = {18「Content-Type」: 'application/json'19}2021回應 = 請求.請求("POST", url, headers=headers, data=有效載荷)2223列印(回應.text)24
1匯入 請求2匯入 json34url = "https://docs-demo.hedera-testnet.quiknode.pro/"56有效載荷 = 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})17標題 = {18「Content-Type」: 'application/json'19}2021回應 = 請求.請求("POST", url, headers=headers, data=有效載荷)2223列印(回應.text)24
1需要 "uri"2require "json"3需要 "net/http"45url = URI("https://docs-demo.hedera-testnet.quiknode.pro/")67https = 網::HTTP.new(url.主機, 網址.port)8https.use_ssl = true910請求 = 淨額::HTTP::POST.新增(網址)11請求["Content-Type"] = "application/json"12請求。主體 = JSON.dump({13"method": "eth_estimateGas",14"params": [15{16"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",17"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"18}19],20"id": 1,21"jsonrpc": "2.0"22})2324回應 = https.請求(請求)25puts 回應。read_body26
1需要 "uri"2require "json"3需要 "net/http"45url = URI("https://docs-demo.hedera-testnet.quiknode.pro/")67https = 網::HTTP.new(url.主機, 網址.port)8https.use_ssl = true910請求 = 淨額::HTTP::POST.新增(網址)11請求["Content-Type"] = "application/json"12請求。主體 = JSON.dump({13"method": "eth_estimateGas",14"params": [15{16"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",17"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"18}19],20"id": 1,21"jsonrpc": "2.0"22})2324回應 = https.請求(請求)25puts 回應。read_body26
1來源: web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.hedera-testnet.quiknode.pro/'))3estimate = w3.eth.estimate_gas({"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"})4print(estimate)
1來源: web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.hedera-testnet.quiknode.pro/'))3estimate = w3.eth.estimate_gas({"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"})4print(estimate)