This guide shows you how to send an eth_gasPrice request to Ethereum Mainnet
with cURL and verify the response.
- An Alchemy API key. If you need one, create an API key.
- A terminal with
curlinstalled
Export your API key as an environment variable:
export ALCHEMY_API_KEY="YOUR_API_KEY"Run this command:
curl "https://eth-mainnet.g.alchemy.com/v2/$ALCHEMY_API_KEY" \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":1}'A successful response looks like this:
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x09184e72a000"
}The result value is the current gas price in wei, encoded as hex.