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

eth_estimateGas

Generates and returns an estimate of how much gas is necessary for Optimism L2 transactions.

Parameters

  1. Transaction Object
    • to - Destination address
    • from (optional) - Sender address
    • value (optional) - Value to send
    • data (optional) - Transaction data

Implementation Examples

curl -X POST https://api-optimism-mainnet-archive.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [{
"to": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb",
"value": "0xde0b6b3a7640000"
}],
"id": 1
}'

Response Example

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

This represents 21,000 gas for a simple ETH transfer on Optimism L2.


Need help? Contact our support team or check the Optimism documentation.