eth_estimateGas RPC Method
Parámetros
transacción
objeto
Cargando...
de
cadena
Cargando...
a
cadena
OBLIGATORIO
Cargando...
gas
entero
Cargando...
precio del gas
entero
Cargando...
valor
entero
Cargando...
datos
cadena
Cargando...
Devoluciones
quantity
cadena
Cargando...
Solicitud
1curl -X POST "https://docs-demo.megaeth-mainnet.quiknode.pro/" \2-H "Content-Type: application/json" \3-d '{4"jsonrpc": "2.0",5"method": "eth_estimateGas",6"params": [7{8"from": "0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4",9"to": "0x63Bc61A75F972140426b36Bb91281f2D1D11a05a",10"value": "0x0"11}12],13"id": 114}'
1curl -X POST "https://docs-demo.megaeth-mainnet.quiknode.pro/" \2-H "Content-Type: application/json" \3-d '{4"jsonrpc": "2.0",5"method": "eth_estimateGas",6"params": [7{8"from": "0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4",9"to": "0x63Bc61A75F972140426b36Bb91281f2D1D11a05a",10"value": "0x0"11}12],13"id": 114}'
1import { ethers } from "ethers";23asíncrono función main() {4const proveedor = new ethers.JsonRpcProvider(«https://docs-demo.megaeth-mainnet.quiknode.pro/»);5const response = await provider.send("eth_estimateGas", [6{7"from": "0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4",8"to": "0x63Bc61A75F972140426b36Bb91281f2D1D11a05a",9«valor»: «0x0»10}11]);12consola.registro(respuesta);13}1415principal();
1import { ethers } from "ethers";23asíncrono función main() {4const proveedor = new ethers.JsonRpcProvider(«https://docs-demo.megaeth-mainnet.quiknode.pro/»);5const response = await provider.send("eth_estimateGas", [6{7"from": "0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4",8"to": "0x63Bc61A75F972140426b36Bb91281f2D1D11a05a",9«valor»: «0x0»10}11]);12consola.registro(respuesta);13}1415principal();
1de web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider(«https://docs-demo.megaeth-mainnet.quiknode.pro/»)))3response = w3.provider.make_request("eth_estimateGas", [{"from":"0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4","to":"0x63Bc61A75F972140426b36Bb91281f2D1D11a05a","value":"0x0"}])4imprimir(respuesta)
1de web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider(«https://docs-demo.megaeth-mainnet.quiknode.pro/»)))3response = w3.provider.make_request("eth_estimateGas", [{"from":"0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4","to":"0x63Bc61A75F972140426b36Bb91281f2D1D11a05a","value":"0x0"}])4imprimir(respuesta)
1import { createPublicClient, http } de 'viem'23asíncrono función main() {4const cliente = createPublicClient({5transporte: http(«https://docs-demo.megaeth-mainnet.quiknode.pro/»)6})78const resultado = await cliente.solicitud({9method: 'eth_estimateGas',10parámetros: [11{12"from": "0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4",13"to": "0x63Bc61A75F972140426b36Bb91281f2D1D11a05a",14"value": "0x0"15}16]17})1819consola.registro(resultado)20}2122principal()
1import { createPublicClient, http } de 'viem'23asíncrono función main() {4const cliente = createPublicClient({5transporte: http(«https://docs-demo.megaeth-mainnet.quiknode.pro/»)6})78const resultado = await cliente.solicitud({9method: 'eth_estimateGas',10parámetros: [11{12"from": "0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4",13"to": "0x63Bc61A75F972140426b36Bb91281f2D1D11a05a",14"value": "0x0"15}16]17})1819consola.registro(resultado)20}2122principal()
1import { Core } desde '@quicknode/sdk'23const core = nuevo Core({4endpointUrl: «https://docs-demo.megaeth-mainnet.quiknode.pro/»,5})67núcleo.cliente8.solicitud({9method: 'eth_estimateGas',10params: [{"from":"0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4","to":"0x63Bc61A75F972140426b36Bb91281f2D1D11a05a","value":"0x0"}]11})12.entonces(res => console.log(res))
1import { Core } desde '@quicknode/sdk'23const core = nuevo Core({4endpointUrl: «https://docs-demo.megaeth-mainnet.quiknode.pro/»,5})67núcleo.cliente8.solicitud({9method: 'eth_estimateGas',10params: [{"from":"0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4","to":"0x63Bc61A75F972140426b36Bb91281f2D1D11a05a","value":"0x0"}]11})12.entonces(res => console.log(res))
1const cuerpo = {2jsonrpc: '2.0',3method: 'eth_estimateGas',4params: [{"from":"0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4","to":"0x63Bc61A75F972140426b36Bb91281f2D1D11a05a","value":"0x0"}],5id: 16}78asíncrono función main() {9const response = await fetch('https://docs-demo.megaeth-mainnet.quiknode.pro/', {10método: 'POST',11headers: {'Content-Type': 'application/json'},12cuerpo: JSON.convertir(body)13})14const datos = await respuesta.json()15consola.registro(datos)16}1718principal()
1const cuerpo = {2jsonrpc: '2.0',3method: 'eth_estimateGas',4params: [{"from":"0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4","to":"0x63Bc61A75F972140426b36Bb91281f2D1D11a05a","value":"0x0"}],5id: 16}78asíncrono función main() {9const response = await fetch('https://docs-demo.megaeth-mainnet.quiknode.pro/', {10método: 'POST',11headers: {'Content-Type': 'application/json'},12cuerpo: JSON.convertir(body)13})14const datos = await respuesta.json()15consola.registro(datos)16}1718principal()
1import solicitudes2import json34url = "https://docs-demo.megaeth-mainnet.quiknode.pro/"56carga útil = json.dumps({7«jsonrpc»: "2.0",8"method": "eth_estimateGas",9«params»: [10{11"from": "0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4",12"to": "0x63Bc61A75F972140426b36Bb91281f2D1D11a05a",13"value": "0x0"14}15],16«id»: 117})18encabezados = {19«Content-Type»: 'application/json'20}2122respuesta = solicitudes.solicitud(«POST», url, encabezados=encabezados, datos=carga útil)2324imprimir(respuesta.texto)
1import solicitudes2import json34url = "https://docs-demo.megaeth-mainnet.quiknode.pro/"56carga útil = json.dumps({7«jsonrpc»: "2.0",8"method": "eth_estimateGas",9«params»: [10{11"from": "0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4",12"to": "0x63Bc61A75F972140426b36Bb91281f2D1D11a05a",13"value": "0x0"14}15],16«id»: 117})18encabezados = {19«Content-Type»: 'application/json'20}2122respuesta = solicitudes.solicitud(«POST», url, encabezados=encabezados, datos=carga útil)2324imprimir(respuesta.texto)
1requiere «uri»2require "json"3require «net/http»45uri = URI(«https://docs-demo.megaeth-mainnet.quiknode.pro/»)67carga útil = {8jsonrpc: "2.0",9id: 1,10method: "eth_estimateGas",11params: [{"from":"0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4","to":"0x63Bc61A75F972140426b36Bb91281f2D1D11a05a","value":"0x0"}]12}1314solicitud = Net::HTTP::POST.nuevo(uri)15solicitud[«Content-Type»] = "application/json"16solicitud.cuerpo = JSON.generar(carga)1718respuesta = Net::HTTP.inicio(uri.host, uri.puerto, use_ssl: true) do |http|19http.solicitud(solicitud)20fin2122inserta la respuesta.cuerpo
1requiere «uri»2require "json"3require «net/http»45uri = URI(«https://docs-demo.megaeth-mainnet.quiknode.pro/»)67carga útil = {8jsonrpc: "2.0",9id: 1,10method: "eth_estimateGas",11params: [{"from":"0xB06c72C825FEEf32A1d5F4837e0972A9A1F628e4","to":"0x63Bc61A75F972140426b36Bb91281f2D1D11a05a","value":"0x0"}]12}1314solicitud = Net::HTTP::POST.nuevo(uri)15solicitud[«Content-Type»] = "application/json"16solicitud.cuerpo = JSON.generar(carga)1718respuesta = Net::HTTP.inicio(uri.host, uri.puerto, use_ssl: true) do |http|19http.solicitud(solicitud)20fin2122inserta la respuesta.cuerpo
Respuesta
1{2«jsonrpc»: "2.0",3"result": "0x5208",4«id»: 15}
1{2«jsonrpc»: "2.0",3"result": "0x5208",4«id»: 15}
¿Aún no tienes una cuenta?
Crea tu punto de conexión de Quicknode en cuestión de segundos y empieza a desarrollar
Empieza gratis