curl --request POST \
--url https://optimism-mainnet.core.chainstack.com/efb0a5eccd2caa5135eb54eba6f7f300 \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"id": 1,
"params": [
{
"from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"to": "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"
},
"latest"
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}
curl --request POST \
--url https://optimism-mainnet.core.chainstack.com/efb0a5eccd2caa5135eb54eba6f7f300 \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"id": 1,
"params": [
{
"from": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
"to": "0xbe0eb53f46cd790cd13851d5eff43d12404d33e8"
},
"latest"
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": "<string>"
}
eth_estimateGas
RPC Methodeth_estimateGas
method estimates the amount of gas required to execute a transaction. This is useful for understanding how much gas might be consumed by a transaction before actually sending it. The estimation is not always accurate but provides a good approximation.
eth_estimateGas
, send a POST request with a JSON RPC call in the body.
string
): (optional) The address the transaction is sent from.string
): The address the transaction is directed to.string
): (optional) The gas limit provided by the sender.string
): (optional) The gas price for the transaction.string
): (optional) The value transferred for the transaction in Wei.string
): (optional) The data sent along with the transaction.string
): The estimated gas required for the transaction.eth_estimateGas
method is essential for:
The estimated gas required
The response is of type object
.
Was this page helpful?