Skip to main content
POST
eth_estimateGas
curl --request POST \
  --url https://rpc.testnet.tempo.xyz/ \
  --header 'Content-Type: application/json' \
  --data '
{
  "jsonrpc": "2.0",
  "method": "eth_estimateGas",
  "params": [
    {
      "from": "0x9729187D9E8Bbefa8295F39f5634cA454dd9d294",
      "to": "0x20c0000000000000000000000000000000000000",
      "data": "0x70a082310000000000000000000000009729187d9e8bbefa8295f39f5634ca454dd9d294"
    }
  ],
  "id": 1
}
'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}
Tempo API method that estimates the gas needed to execute a transaction. On Tempo, gas fees are paid in TIP-20 stablecoins, not a native token.

Parameters

  • callObject — the call object:
    • from — (optional) address the transaction is sent from
    • to — (optional) address the transaction is directed to
    • gas — (optional) gas provided for the transaction
    • gasPrice — (optional) gas price
    • value — (optional) value sent with the transaction
    • data — (optional) hash of the method signature and encoded parameters

Response

  • result — the estimated gas amount encoded as hexadecimal

eth_estimateGas code examples

const Web3 = require("web3");
const NODE_URL = "CHAINSTACK_NODE_URL";
const web3 = new Web3(NODE_URL);

async function estimateGas() {
  const gas = await web3.eth.estimateGas({
    from: "0x9729187D9E8Bbefa8295F39f5634cA454dd9d294",
    to: "0x20c0000000000000000000000000000000000000",
    data: "0x70a082310000000000000000000000009729187d9e8bbefa8295f39f5634ca454dd9d294"
  });
  console.log(`Estimated gas: ${gas}`);
}

estimateGas()

Body

application/json
jsonrpc
string
default:2.0
method
string
default:eth_estimateGas
params
any[]

Transaction call object

id
integer
default:1

Response

200 - application/json

The estimated gas

jsonrpc
string
id
integer
result
string

The estimated gas amount encoded as hexadecimal