⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

eth_estimateGas

Generates and returns an estimate of gas required to execute a transaction.

Parameters

  1. Transaction Object - Same as eth_call
    • from (optional): Sender address
    • to: Recipient or contract address
    • gas (optional): Gas limit
    • gasPrice (optional): Gas price
    • value (optional): Value in wei
    • data: Encoded function data
{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [{
"from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"value": "0x9184e72a"
}],
"id": 1
}

Returns

QUANTITY - The estimated gas amount.

Implementation Examples

curl -X POST https://api-tron-jsonrpc.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [{
"to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
"data": "0x"
}],
"id": 1
}'

Example Response

{
"jsonrpc": "2.0",
"id": 1,
"result": "0x5208"
}