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>"
}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>"
}callObject — the call object:
from — (optional) address the transaction is sent fromto — (optional) address the transaction is directed togas — (optional) gas provided for the transactiongasPrice — (optional) gas pricevalue — (optional) value sent with the transactiondata — (optional) hash of the method signature and encoded parametersresult — the estimated gas amount encoded as hexadecimaleth_estimateGas code examplesconst 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()
Was this page helpful?