π Don't have an API Key? Start here before making your first request!
You can interact with Alchemy's infrastructure provider using JSON-RPC and your command line.
Let's make a call to eth_gasPrice, so we'll fill this in as our method.
Simply replace demo with your Alchemy API Key and you can run this from the command line to retrieve the current gas price:
curl https://eth-mainnet.g.alchemy.com/v2/demo \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":73}'Results:
{ "id": 73,
"jsonrpc": "2.0",
"result": "0x09184e72a000" // 10000000000000 }Congratulations on making your first Alchemy request! π
Next, we recommend you check out setting up Alchemy with Viem or any web3 library using AI!