eth_estimateGas RPC メソッド
パラメータ
取引
オブジェクト
必須
読み込み中...
出典:
文字列
読み込み中...
~へ
文字列
必須
読み込み中...
ガス
整数
読み込み中...
gasPrice
整数
読み込み中...
値
整数
読み込み中...
データ
文字列
読み込み中...
ブロック番号
文字列
読み込み中...
返品
数量
文字列
読み込み中...
リクエスト
1curl -X POST "https://docs-demo.katana-mainnet.quiknode.pro/" \2-H "Content-Type: application/json" \3-d '{4"jsonrpc": "2.0",5"method": "eth_estimateGas",6"params": [7{8"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",9"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",10"gas": "0x0",11"gasPrice": "0x0",12"value": "0x0"13},14「最新」15],16"id": 117}'
1curl -X POST "https://docs-demo.katana-mainnet.quiknode.pro/" \2-H "Content-Type: application/json" \3-d '{4"jsonrpc": "2.0",5"method": "eth_estimateGas",6"params": [7{8"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",9"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",10"gas": "0x0",11"gasPrice": "0x0",12"value": "0x0"13},14「最新」15],16"id": 117}'
1import { ethers } from "ethers";23async 関数 main() {4const provider = new ethers.JsonRpcProvider("https://docs-demo.katana-mainnet.quiknode.pro/");5const response = await provider.send("eth_estimateGas", [6{7"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",8"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",9"gas": "0x0",10"gasPrice": "0x0",11「value」: "0x0"12},13「最新」14]);15コンソール.log(レスポンス);16}1718メイン();
1import { ethers } from "ethers";23async 関数 main() {4const provider = new ethers.JsonRpcProvider("https://docs-demo.katana-mainnet.quiknode.pro/");5const response = await provider.send("eth_estimateGas", [6{7"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",8"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",9"gas": "0x0",10"gasPrice": "0x0",11「value」: "0x0"12},13「最新」14]);15コンソール.log(レスポンス);16}1718メイン();
1出典: web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.katana-mainnet.quiknode.pro/'))3response = w3.provider.make_request("eth_estimateGas", [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"])4印刷(レスポンス)
1出典: web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.katana-mainnet.quiknode.pro/'))3response = w3.provider.make_request("eth_estimateGas", [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"])4印刷(レスポンス)
1import { createPublicClient, http } from 'viem'23async 関数 main() {4const クライアント = createPublicClient({5transport: http('https://docs-demo.katana-mainnet.quiknode.pro/')6})78const result = await client.リクエスト({9メソッド: 'eth_estimateGas',10params: [11{12"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",13"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",14"gas": "0x0",15"gasPrice": "0x0",16"value": "0x0"17},18「最新」19]20})2122コンソール.log(結果)23}2425メイン()
1import { createPublicClient, http } from 'viem'23async 関数 main() {4const クライアント = createPublicClient({5transport: http('https://docs-demo.katana-mainnet.quiknode.pro/')6})78const result = await client.リクエスト({9メソッド: 'eth_estimateGas',10params: [11{12"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",13"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",14"gas": "0x0",15"gasPrice": "0x0",16"value": "0x0"17},18「最新」19]20})2122コンソール.log(結果)23}2425メイン()
1import { Core } from '@quicknode/sdk'23const コア = new Core({4endpointUrl: "https://docs-demo.katana-mainnet.quiknode.pro/",5})67コア.クライアント8.リクエスト({9メソッド: 'eth_estimateGas',10params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"]11})12.その後(res => console.log(res))
1import { Core } from '@quicknode/sdk'23const コア = new Core({4endpointUrl: "https://docs-demo.katana-mainnet.quiknode.pro/",5})67コア.クライアント8.リクエスト({9メソッド: 'eth_estimateGas',10params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"]11})12.その後(res => console.log(res))
1const body = {2jsonrpc: '2.0',3メソッド: 'eth_estimateGas',4params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"],5id: 16}78async 関数 main() {9const response = await fetch('https://docs-demo.katana-mainnet.quiknode.pro/', {10メソッド: 'POST',11headers: {'Content-Type': 'application/json'},12本文: JSON.stringify(body)13})14const データ = await response.json()15コンソール.log(データ)16}1718メイン()
1const body = {2jsonrpc: '2.0',3メソッド: 'eth_estimateGas',4params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"],5id: 16}78async 関数 main() {9const response = await fetch('https://docs-demo.katana-mainnet.quiknode.pro/', {10メソッド: 'POST',11headers: {'Content-Type': 'application/json'},12本文: JSON.stringify(body)13})14const データ = await response.json()15コンソール.log(データ)16}1718メイン()
1import リクエスト2import json34url = "https://docs-demo.katana-mainnet.quiknode.pro/"56ペイロード = json.dumps({7"jsonrpc": "2.0",8「メソッド」: "eth_estimateGas",9"params": [10{11"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",12"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",13"gas": "0x0",14"gasPrice": "0x0",15"value": "0x0"16},17「最新」18],19"id": 120})21ヘッダー = {22「Content-Type」: 'application/json'23}2425回答 = リクエスト.リクエスト("POST", url, headers=headers, データ=ペイロード)2627印刷(レスポンス.text)
1import リクエスト2import json34url = "https://docs-demo.katana-mainnet.quiknode.pro/"56ペイロード = json.dumps({7"jsonrpc": "2.0",8「メソッド」: "eth_estimateGas",9"params": [10{11"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",12"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",13"gas": "0x0",14"gasPrice": "0x0",15"value": "0x0"16},17「最新」18],19"id": 120})21ヘッダー = {22「Content-Type」: 'application/json'23}2425回答 = リクエスト.リクエスト("POST", url, headers=headers, データ=ペイロード)2627印刷(レスポンス.text)
1require "uri"2require "json"3require "net/http"45uri = URI("https://docs-demo.katana-mainnet.quiknode.pro/")67ペイロード = {8jsonrpc: "2.0",9id: 1,10メソッド: "eth_estimateGas",11params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"]12}1314リクエスト = ネット::HTTP::POST.new(URI)15リクエスト["Content-Type"] = "application/json"16リクエスト.本文 = JSON.generate(ペイロード)1718回答 = ネット::HTTP.開始(uri.host, uri.port, use_ssl: true) do |http|19http.リクエスト(リクエスト)20終わり2122レスポンスを格納する。body
1require "uri"2require "json"3require "net/http"45uri = URI("https://docs-demo.katana-mainnet.quiknode.pro/")67ペイロード = {8jsonrpc: "2.0",9id: 1,10メソッド: "eth_estimateGas",11params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"]12}1314リクエスト = ネット::HTTP::POST.new(URI)15リクエスト["Content-Type"] = "application/json"16リクエスト.本文 = JSON.generate(ペイロード)1718回答 = ネット::HTTP.開始(uri.host, uri.port, use_ssl: true) do |http|19http.リクエスト(リクエスト)20終わり2122レスポンスを格納する。body
回答
1{2"jsonrpc": "2.0",3"id": 1,4"結果": "0x5208"5}
1{2"jsonrpc": "2.0",3"id": 1,4"結果": "0x5208"5}