Make Your First Alchemy Request

Learn how to send a blockchain request using Alchemy.

👋 New to Alchemy? Get access to Alchemy for free here.

You can interact with Alchemy’s infrastructure provider using JSON-RPC and your command line.

For manual requests, we recommend interacting with the JSON-RPC via POST requests. Simply pass in the Content-Type: application/json header and your query as the POST body with the following fields:

  • jsonrpc: The JSON-RPC version—currently, only 2.0 is supported.
  • method: The ETH API method. See API reference.
  • params: A list of parameters to pass to the method.
  • id: The ID of your request. Will be returned by the response so you can keep track of which request a response belongs to.

Here is an example you can run from the Terminal/Windows/LINUX command line to retrieve the current gas price:

shell
$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}'

Please remember to replace “demo” in the request URL with your actual Alchemy API key you created in the last step!

Results:

Result
1{ "id": 73,
2 "jsonrpc": "2.0",
3 "result": "0x09184e72a000" // 10000000000000 }