eth_estimateGas RPC Method
Parámetros
transacción
objeto
OBLIGATORIO
Cargando...
de
cadena
Cargando...
a
cadena
OBLIGATORIO
Cargando...
gas
entero
Cargando...
precio del gas
entero
Cargando...
valor
entero
Cargando...
datos
cadena
Cargando...
número de bloque
cadena
Cargando...
Devoluciones
quantity
Cargando...
Solicitud
1curl -X POST "https://docs-demo.cyber-sepolia.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«último»15],16"id": 117}'
1curl -X POST "https://docs-demo.cyber-sepolia.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«último»15],16"id": 117}'
1import { ethers } from "ethers";23asíncrono función main() {4const proveedor = new ethers.JsonRpcProvider(«https://docs-demo.cyber-sepolia.quiknode.pro/»);5const response = await provider.send("eth_estimateGas", [6{7"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",8"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",9"gas": "0x0",10"gasPrice": "0x0",11«valor»: «0x0»12},13«último»14]);15consola.registro(respuesta);16}1718principal();
1import { ethers } from "ethers";23asíncrono función main() {4const proveedor = new ethers.JsonRpcProvider(«https://docs-demo.cyber-sepolia.quiknode.pro/»);5const response = await provider.send("eth_estimateGas", [6{7"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",8"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",9"gas": "0x0",10"gasPrice": "0x0",11«valor»: «0x0»12},13«último»14]);15consola.registro(respuesta);16}1718principal();
1de web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider(«https://docs-demo.cyber-sepolia.quiknode.pro/»)))3response = w3.provider.make_request("eth_estimateGas", [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"])4imprimir(respuesta)
1de web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider(«https://docs-demo.cyber-sepolia.quiknode.pro/»)))3response = w3.provider.make_request("eth_estimateGas", [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"])4imprimir(respuesta)
1import { createPublicClient, http } de 'viem'23asíncrono función main() {4const cliente = createPublicClient({5transporte: http(«https://docs-demo.cyber-sepolia.quiknode.pro/»)6})78const resultado = await cliente.solicitud({9method: 'eth_estimateGas',10parámetros: [11{12"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",13"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",14"gas": "0x0",15"gasPrice": "0x0",16"value": "0x0"17},18«último»19]20})2122consola.registro(resultado)23}2425principal()
1import { createPublicClient, http } de 'viem'23asíncrono función main() {4const cliente = createPublicClient({5transporte: http(«https://docs-demo.cyber-sepolia.quiknode.pro/»)6})78const resultado = await cliente.solicitud({9method: 'eth_estimateGas',10parámetros: [11{12"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",13"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",14"gas": "0x0",15"gasPrice": "0x0",16"value": "0x0"17},18«último»19]20})2122consola.registro(resultado)23}2425principal()
1import { Core } desde '@quicknode/sdk'23const core = nuevo Core({4endpointUrl: «https://docs-demo.cyber-sepolia.quiknode.pro/»,5})67núcleo.cliente8.solicitud({9method: 'eth_estimateGas',10params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"]11})12.entonces(res => console.log(res))
1import { Core } desde '@quicknode/sdk'23const core = nuevo Core({4endpointUrl: «https://docs-demo.cyber-sepolia.quiknode.pro/»,5})67núcleo.cliente8.solicitud({9method: 'eth_estimateGas',10params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"]11})12.entonces(res => console.log(res))
1const cuerpo = {2jsonrpc: '2.0',3method: 'eth_estimateGas',4params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"],5id: 16}78asíncrono función main() {9const response = await fetch('https://docs-demo.cyber-sepolia.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":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"],5id: 16}78asíncrono función main() {9const response = await fetch('https://docs-demo.cyber-sepolia.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.cyber-sepolia.quiknode.pro/"56carga útil = json.dumps({7«jsonrpc»: "2.0",8"method": "eth_estimateGas",9«params»: [10{11"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",12"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",13"gas": "0x0",14"gasPrice": "0x0",15"value": "0x0"16},17«último»18],19«id»: 120})21encabezados = {22«Content-Type»: 'application/json'23}2425respuesta = solicitudes.solicitud(«POST», url, encabezados=encabezados, datos=carga útil)2627imprimir(respuesta.texto)
1import solicitudes2import json34url = "https://docs-demo.cyber-sepolia.quiknode.pro/"56carga útil = json.dumps({7«jsonrpc»: "2.0",8"method": "eth_estimateGas",9«params»: [10{11"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",12"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2",13"gas": "0x0",14"gasPrice": "0x0",15"value": "0x0"16},17«último»18],19«id»: 120})21encabezados = {22«Content-Type»: 'application/json'23}2425respuesta = solicitudes.solicitud(«POST», url, encabezados=encabezados, datos=carga útil)2627imprimir(respuesta.texto)
1requiere «uri»2require "json"3require «net/http»45uri = URI(«https://docs-demo.cyber-sepolia.quiknode.pro/»)67carga útil = {8jsonrpc: "2.0",9id: 1,10method: "eth_estimateGas",11params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"]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.cyber-sepolia.quiknode.pro/»)67carga útil = {8jsonrpc: "2.0",9id: 1,10method: "eth_estimateGas",11params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2","gas":"0x0","gasPrice":"0x0","value":"0x0"},"latest"]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«id»: 1,4"result": "0x5208"5}
1{2«jsonrpc»: "2.0",3«id»: 1,4"result": "0x5208"5}
¿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