Skip to main content

Get Block Number

Welcome to the Getting Started guide! Here, you'll learn how to call your first Ethereum RPC, such as getBlockNumber.

Prerequisites

  1. Blacksun account: Make sure you have a Blacksun account. If you don't, sign up here.
  2. API Key: You need an API Key to make Ethereum RPC calls. Learn how to create one in our Create API Key guide.

Call Your First Ethereum RPC

We'll use getBlockNumber as an example for your first Ethereum RPC call. Follow these steps:

  1. Replace [BLACSKUN_RPC_ENDPOINT] with your Blacksun RPC endpoint URL.
  2. Use one of the code snippets below in your preferred language to make the RPC call:
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' [BLACSKUN_RPC_ENDPOINT]

Congratulations! You've successfully called your first Ethereum RPC using Blacksun. Explore more RPC methods in our Ethereum RPC documentation.