Getting started with TheRPC

Curl

This guide demonstrates how to interact with Ethereum nodes directly using Curl commands. This is useful for testing, debugging, and understanding the underlying API calls.

Pay attention!
Hey there! Just a friendly heads-up: this page is meant to give you a solid overview of working with Curl/Http requests. For hands-on code examples, check out our API Methods documentation where you'll find ready-to-use examples in all supported languages!

Basic Usage

Here's a basic example of getting the latest block number:

curl -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
  YOUR_ETHEREUM_NODE_URL

Authentication

When using authenticated endpoints:

curl -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \
  YOUR_ETHEREUM_NODE_URL

Common Operations

Get Balance

curl -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x742d35Cc6634C0532925a3b844Bc454e4438f44e","latest"],"id":1}' \
  YOUR_ETHEREUM_NODE_URL

Get Transaction

curl -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x88df016429689c079f3b2f6ad39fa052532c56795b733da78a91ebe6a713944b"],"id":1}' \
  YOUR_ETHEREUM_NODE_URL

See also

Help Us Get Better!
Share this page and help us create an even better product for you.