eth_estimateGas RPC Method
Parâmetros
transação
objeto
OBRIGATÓRIO
Carregando...
de
cadeia de caracteres
Carregando...
para
cadeia de caracteres
OBRIGATÓRIO
Carregando...
gas
número inteiro
Carregando...
gasPrice
número inteiro
Carregando...
valor
número inteiro
Carregando...
dados
cadeia de caracteres
Carregando...
número do bloco
cadeia de caracteres
Carregando...
Devoluções
resultado
cadeia de caracteres
Carregando...
Pedido
1curl -X POST "https://docs-demo.story-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},11"mais recente"12],13"id": 114}'
1curl -X POST "https://docs-demo.story-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},11"mais recente"12],13"id": 114}'
1import { ethers } from "ethers";23async função main() {4const provider = new ethers.JsonRpcProvider("https://docs-demo.story-mainnet.quiknode.pro/");5const response = await provider.send("eth_estimateGas", [6{7"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",8"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"9},10"mais recente"11]);12consola.registo(resposta);13}1415principal();
1import { ethers } from "ethers";23async função main() {4const provider = new ethers.JsonRpcProvider("https://docs-demo.story-mainnet.quiknode.pro/");5const response = await provider.send("eth_estimateGas", [6{7"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",8"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"9},10"mais recente"11]);12consola.registo(resposta);13}1415principal();
1de web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.story-mainnet.quiknode.pro/'))3response = w3.provider.make_request("eth_estimateGas", [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"},"latest"])4imprimir(resposta)
1de web3 import Web3, HTTPProvider2w3 = Web3(HTTPProvider('https://docs-demo.story-mainnet.quiknode.pro/'))3response = w3.provider.make_request("eth_estimateGas", [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"},"latest"])4imprimir(resposta)
1importar { createPublicClient, http } de 'viem'23async função main() {4const cliente = createPublicClient({5transport: http('https://docs-demo.story-mainnet.quiknode.pro/')6})78const resultado = await cliente.pedido({9method: 'eth_estimateGas',10parâmetros: [11{12"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",13"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"14},15"mais recente"16]17})1819consola.registo(resultado)20}2122principal()
1importar { createPublicClient, http } de 'viem'23async função main() {4const cliente = createPublicClient({5transport: http('https://docs-demo.story-mainnet.quiknode.pro/')6})78const resultado = await cliente.pedido({9method: 'eth_estimateGas',10parâmetros: [11{12"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",13"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"14},15"mais recente"16]17})1819consola.registo(resultado)20}2122principal()
1import { QuicknodeSdk } from '@quicknode/sdk'23const qn = new QuicknodeSdk({})45const result = await qn.rpc.call(6'eth_estimateGas',7[8{9"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",10"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"11},12"mais recente"13],14undefined,15'https://docs-demo.story-mainnet.quiknode.pro/'16)1718console.log(result)
1import { QuicknodeSdk } from '@quicknode/sdk'23const qn = new QuicknodeSdk({})45const result = await qn.rpc.call(6'eth_estimateGas',7[8{9"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",10"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"11},12"mais recente"13],14undefined,15'https://docs-demo.story-mainnet.quiknode.pro/'16)1718console.log(result)
1import asyncio2from quicknode_sdk import QuicknodeSdk, SdkFullConfig34async def main():5qn = QuicknodeSdk(SdkFullConfig(api_key=None))6result = await qn.rpc.call(7"eth_estimateGas",8[9{10"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",11"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"12},13"mais recente"14],15endpoint_url="https://docs-demo.story-mainnet.quiknode.pro/",16)17print(result)1819asyncio.run(main())
1import asyncio2from quicknode_sdk import QuicknodeSdk, SdkFullConfig34async def main():5qn = QuicknodeSdk(SdkFullConfig(api_key=None))6result = await qn.rpc.call(7"eth_estimateGas",8[9{10"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",11"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"12},13"mais recente"14],15endpoint_url="https://docs-demo.story-mainnet.quiknode.pro/",16)17print(result)1819asyncio.run(main())
1require "quicknode_sdk"23qn = QuicknodeSdk::SDK.from_config(api_key: nil)45result = qn.rpc.call(6method: "eth_estimateGas",7params: [8{9"from" => "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",10"to" => "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"11},12"mais recente"13],14endpoint_url: "https://docs-demo.story-mainnet.quiknode.pro/"15)1617apresenta o resultado
1require "quicknode_sdk"23qn = QuicknodeSdk::SDK.from_config(api_key: nil)45result = qn.rpc.call(6method: "eth_estimateGas",7params: [8{9"from" => "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",10"to" => "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"11},12"mais recente"13],14endpoint_url: "https://docs-demo.story-mainnet.quiknode.pro/"15)1617apresenta o resultado
1use quicknode_sdk::{QuicknodeSdk, SdkFullConfig};23#[tokio::main]4async fn main() -> Result<(), Box<dyn std::error::Error>> {5let qn = QuicknodeSdk::new(&SdkFullConfig::keyless())?;6let result = qn7.rpc8.call(9"eth_estimateGas",10Some(serde_json::json!([11{12"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",13"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"14},15"mais recente"16])),17None,18Some("https://docs-demo.story-mainnet.quiknode.pro/".into()),19)20.await?;2122println!("{result}");23Ok(())24}
1use quicknode_sdk::{QuicknodeSdk, SdkFullConfig};23#[tokio::main]4async fn main() -> Result<(), Box<dyn std::error::Error>> {5let qn = QuicknodeSdk::new(&SdkFullConfig::keyless())?;6let result = qn7.rpc8.call(9"eth_estimateGas",10Some(serde_json::json!([11{12"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",13"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"14},15"mais recente"16])),17None,18Some("https://docs-demo.story-mainnet.quiknode.pro/".into()),19)20.await?;2122println!("{result}");23Ok(())24}
1const corpo = {2jsonrpc: '2.0',3method: 'eth_estimateGas',4params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"},"latest"],5id: 16}78async função main() {9const response = await fetch('https://docs-demo.story-mainnet.quiknode.pro/', {10método: 'POST',11headers: {'Content-Type': 'application/json'},12corpo: JSON.converter em string(body)13})14const dados = await resposta.json()15consola.registo(dados)16}1718principal()
1const corpo = {2jsonrpc: '2.0',3method: 'eth_estimateGas',4params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"},"latest"],5id: 16}78async função main() {9const response = await fetch('https://docs-demo.story-mainnet.quiknode.pro/', {10método: 'POST',11headers: {'Content-Type': 'application/json'},12corpo: JSON.converter em string(body)13})14const dados = await resposta.json()15consola.registo(dados)16}1718principal()
1importar pedidos2import json34url = "https://docs-demo.story-mainnet.quiknode.pro/"56carga útil = json.dumps({7"jsonrpc": "2.0",8"method": "eth_estimateGas",9«params»: [10{11"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",12"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"13},14"mais recente"15],16"id": 117})18cabeçalhos = {19'Content-Type': 'application/json'20}2122resposta = pedidos.pedido("POST", url, headers=headers, dados=carga útil)2324imprimir(resposta.texto)
1importar pedidos2import json34url = "https://docs-demo.story-mainnet.quiknode.pro/"56carga útil = json.dumps({7"jsonrpc": "2.0",8"method": "eth_estimateGas",9«params»: [10{11"from": "0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef",12"to": "0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"13},14"mais recente"15],16"id": 117})18cabeçalhos = {19'Content-Type': 'application/json'20}2122resposta = pedidos.pedido("POST", url, headers=headers, dados=carga útil)2324imprimir(resposta.texto)
1exigir "uri"2require "json"3necessita de "net/http"45uri = URI("https://docs-demo.story-mainnet.quiknode.pro/")67carga útil = {8jsonrpc: "2.0",9id: 1,10method: "eth_estimateGas",11params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"},"latest"]12}1314pedido = Líquido::HTTP::POST.novo(uri)15pedido["Content-Type"] = "application/json"16pedido.corpo = JSON.gerar(carga)1718resposta = Líquido::HTTP.início(uri.host, uri.porta, use_ssl: true) executar |http|19http.pedido(pedido)20fim2122insere a resposta.corpo
1exigir "uri"2require "json"3necessita de "net/http"45uri = URI("https://docs-demo.story-mainnet.quiknode.pro/")67carga útil = {8jsonrpc: "2.0",9id: 1,10method: "eth_estimateGas",11params: [{"from":"0xd9275Eb8276E14b9e28d5f9B12e90dDAAF3586Ef","to":"0xD2374e67cf81135c220f3E806afdCd7Cab6515f2"},"latest"]12}1314pedido = Líquido::HTTP::POST.novo(uri)15pedido["Content-Type"] = "application/json"16pedido.corpo = JSON.gerar(carga)1718resposta = Líquido::HTTP.início(uri.host, uri.porta, use_ssl: true) executar |http|19http.pedido(pedido)20fim2122insere a resposta.corpo
Resposta
1{2"jsonrpc": "2.0",3"id": 1,4"result": "0x5208"5}
1{2"jsonrpc": "2.0",3"id": 1,4"result": "0x5208"5}
Ainda não tem uma conta?
Crieendpoint seuendpoint Quicknode endpoint segundos e comece a desenvolver
Comece gratuitamente