eth_estimateGas

Estimates the gas required to execute a transaction on the Ethereum network.

Example

import { getRpcClient, eth_estimateGas } from "thirdweb/rpc";
const rpcRequest = getRpcClient({ client, chain });
const gas = await eth_estimateGas(rpcRequest, {
to: "0x...",
...
});

Parameters

Returns

A promise that resolves to the estimated gas as a bigint.