For the complete documentation index, see llms.txt. This page is also available as Markdown.

eth_estimateGas - Tempo

Example code for the eth_estimateGas JSON-RPC method. Complete guide on how to use eth_estimateGas JSON-RPC in GetBlock Web3 documentation.

Estimates the gas required to execute a transaction. Unlike standard Ethereum, the gas allowance is calculated from the effective fee payer's selected TIP-20 fee token balance, not from a native ETH balance. The from address in the call object determines whose TIP-20 balance is checked; if the transaction uses fee sponsorship, the sponsoring address's balance is checked instead.

Parameters

Parameter
Type
Required
Description

callObject

object

Yes

Transaction-shaped object with to, data, and optional from, value

blockParameter

string

No

Optional block parameter (default: "latest")

Request Example

curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_estimateGas",
    "params": [
        {
            "from": "0xd85498dbeaeb1df24be52eed4f52eac2fbd56245",
            "to": "0x4242424242424242424242424242424242424242",
            "data": "0xa9059cbb000000000000000000000000d85498dbeaeb1df24be52eed4f52eac2fbd5624500000000000000000000000000000000000000000000000000000000000003e8"
        }
    ],
    "id": "getblock.io"
}'

Response Example

Response Parameters

Field
Type
Description

result

string

Estimated gas units required (hex). Convert to TIP-20 fee cost using the current base fee

Use Cases

  • Setting an appropriate gas limit before signing a payment transaction

  • Showing users an estimated cost in TIP-20 fee tokens in wallet UIs

  • Detecting transactions that would revert (estimate fails)

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid <ACCESS-TOKEN>

-32602

Invalid params

Request parameters are missing or malformed

429

Too Many Requests

Rate limit exceeded for your plan

-32000

Execution reverted

Transaction would revert; estimate cannot be returned

-32000

Insufficient fee token balance

Fee payer's selected TIP-20 fee token balance is too low to cover gas

SDK Integration

Last updated

Was this helpful?