eth_estimateGas RPC メソッド
パラメータ
取引
オブジェクト
読み込み中...
出典:
文字列
読み込み中...
~へ
文字列
必須
読み込み中...
ガス
整数
読み込み中...
gasPrice
整数
読み込み中...
値
整数
読み込み中...
データ
文字列
読み込み中...
返品
数量
文字列
読み込み中...
リクエスト
1curl -X POST "https://docs-demo.robinhood-mainnet.quiknode.pro/" \2-H "Content-Type: application/json" \3-d '{4"jsonrpc": "2.0",5"method": "eth_estimateGas",6"params": [7{8"from": "0xf4e84fee3aa08aec9c2580260311d28de371d937",9"to": "0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e",10"value": "0x0"11}12],13"id": 114}'
1curl -X POST "https://docs-demo.robinhood-mainnet.quiknode.pro/" \2-H "Content-Type: application/json" \3-d '{4"jsonrpc": "2.0",5"method": "eth_estimateGas",6"params": [7{8"from": "0xf4e84fee3aa08aec9c2580260311d28de371d937",9"to": "0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e",10"value": "0x0"11}12],13"id": 114}'
1import { ethers } from "ethers";23async 関数 main() {4const provider = new ethers.JsonRpcProvider("https://docs-demo.robinhood-mainnet.quiknode.pro/");5const response = await provider.send("eth_estimateGas", [6{7"from": "0xf4e84fee3aa08aec9c2580260311d28de371d937",8"to": "0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e",9「value」: "0x0"10}11]);12コンソール.log(レスポンス);13}1415メイン();
1import { ethers } from "ethers";23async 関数 main() {4const provider = new ethers.JsonRpcProvider("https://docs-demo.robinhood-mainnet.quiknode.pro/");5const response = await provider.send("eth_estimateGas", [6{7"from": "0xf4e84fee3aa08aec9c2580260311d28de371d937",8"to": "0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e",9「value」: "0x0"10}11]);12コンソール.log(レスポンス);13}1415メイン();
1出典: web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.robinhood-mainnet.quiknode.pro/'))3response = w3.provider.make_request("eth_estimateGas", [{"from":"0xf4e84fee3aa08aec9c2580260311d28de371d937","to":"0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e","value":"0x0"}])4印刷(レスポンス)
1出典: web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.robinhood-mainnet.quiknode.pro/'))3response = w3.provider.make_request("eth_estimateGas", [{"from":"0xf4e84fee3aa08aec9c2580260311d28de371d937","to":"0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e","value":"0x0"}])4印刷(レスポンス)
1import { createPublicClient, http } from 'viem'23async 関数 main() {4const クライアント = createPublicClient({5transport: http('https://docs-demo.robinhood-mainnet.quiknode.pro/')6})78const result = await client.リクエスト({9メソッド: 'eth_estimateGas',10params: [11{12"from": "0xf4e84fee3aa08aec9c2580260311d28de371d937",13"to": "0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e",14"value": "0x0"15}16]17})1819コンソール.log(結果)20}2122メイン()
1import { createPublicClient, http } from 'viem'23async 関数 main() {4const クライアント = createPublicClient({5transport: http('https://docs-demo.robinhood-mainnet.quiknode.pro/')6})78const result = await client.リクエスト({9メソッド: 'eth_estimateGas',10params: [11{12"from": "0xf4e84fee3aa08aec9c2580260311d28de371d937",13"to": "0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e",14"value": "0x0"15}16]17})1819コンソール.log(結果)20}2122メイン()
1import { Core } from '@quicknode/sdk'23const コア = new Core({4endpointUrl: "https://docs-demo.robinhood-mainnet.quiknode.pro/",5})67コア.クライアント8.リクエスト({9メソッド: 'eth_estimateGas',10params: [{"from":"0xf4e84fee3aa08aec9c2580260311d28de371d937","to":"0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e","value":"0x0"}]11})12.その後(res => console.log(res))
1import { Core } from '@quicknode/sdk'23const コア = new Core({4endpointUrl: "https://docs-demo.robinhood-mainnet.quiknode.pro/",5})67コア.クライアント8.リクエスト({9メソッド: 'eth_estimateGas',10params: [{"from":"0xf4e84fee3aa08aec9c2580260311d28de371d937","to":"0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e","value":"0x0"}]11})12.その後(res => console.log(res))
1const body = {2jsonrpc: '2.0',3メソッド: 'eth_estimateGas',4params: [{"from":"0xf4e84fee3aa08aec9c2580260311d28de371d937","to":"0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e","value":"0x0"}],5id: 16}78async 関数 main() {9const response = await fetch('https://docs-demo.robinhood-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":"0xf4e84fee3aa08aec9c2580260311d28de371d937","to":"0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e","value":"0x0"}],5id: 16}78async 関数 main() {9const response = await fetch('https://docs-demo.robinhood-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.robinhood-mainnet.quiknode.pro/"56ペイロード = json.dumps({7"jsonrpc": "2.0",8「メソッド」: "eth_estimateGas",9"params": [10{11"from": "0xf4e84fee3aa08aec9c2580260311d28de371d937",12"to": "0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e",13"value": "0x0"14}15],16"id": 117})18ヘッダー = {19「Content-Type」: 'application/json'20}2122回答 = リクエスト.リクエスト("POST", url, headers=headers, データ=ペイロード)2324印刷(レスポンス.text)
1import リクエスト2import json34url = "https://docs-demo.robinhood-mainnet.quiknode.pro/"56ペイロード = json.dumps({7"jsonrpc": "2.0",8「メソッド」: "eth_estimateGas",9"params": [10{11"from": "0xf4e84fee3aa08aec9c2580260311d28de371d937",12"to": "0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e",13"value": "0x0"14}15],16"id": 117})18ヘッダー = {19「Content-Type」: 'application/json'20}2122回答 = リクエスト.リクエスト("POST", url, headers=headers, データ=ペイロード)2324印刷(レスポンス.text)
1require "uri"2require "json"3require "net/http"45uri = URI("https://docs-demo.robinhood-mainnet.quiknode.pro/")67ペイロード = {8jsonrpc: "2.0",9id: 1,10メソッド: "eth_estimateGas",11params: [{"from":"0xf4e84fee3aa08aec9c2580260311d28de371d937","to":"0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e","value":"0x0"}]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.robinhood-mainnet.quiknode.pro/")67ペイロード = {8jsonrpc: "2.0",9id: 1,10メソッド: "eth_estimateGas",11params: [{"from":"0xf4e84fee3aa08aec9c2580260311d28de371d937","to":"0xb910a5156f4244ae1aa20f1b00d39d9d9c83c18e","value":"0x0"}]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"result": "0x5ff8"5}
1{2"jsonrpc": "2.0",3"id": 1,4"result": "0x5ff8"5}