POST
/
efb0a5eccd2caa5135eb54eba6f7f300
curl --request POST \
  --url https://optimism-mainnet.core.chainstack.com/efb0a5eccd2caa5135eb54eba6f7f300 \
  --header 'Content-Type: application/json' \
  --data '{
  "jsonrpc": "2.0",
  "method": "eth_gasPrice",
  "id": 1
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": "<string>"
}

Optimism API method eth_gasPrice retrieves the current gas price, which is crucial for executing transactions on the Optimism network. The gas price is determined by the demand for transaction processing and the supply of miners willing to process transactions.

Get you own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • none — This method does not require any parameters.

Response

  • result — the current gas price, encoded as a hexadecimal string. This value fluctuates based on network activity and miner demand.

Use case

The eth_gasPrice method is essential for:

  • Users and applications preparing to send transactions, enabling them to set an appropriate gas price to ensure timely transaction processing.
  • Wallets and interfaces that provide gas price suggestions to optimize for cost and confirmation time.
  • Developers and analysts monitoring the Optimism network’s congestion and transaction costs.

This method provides a straightforward way to access the current gas price, helping users and applications interact with the Optimism blockchain more effectively by estimating transaction costs accurately.

Body

application/json
jsonrpc
string
default:2.0
method
string
default:eth_gasPrice
id
integer
default:1

Response

200 - application/json
The current gas price
jsonrpc
string
id
integer
result
string