Getting started with Nethermind’s Starknet RPC service

Starknet

December 12, 2023

Introduction to Nethermind’s Starknet RPC service

Nethermind provides a robust and comprehensive RPC infrastructure for developers entering the Starknet ecosystem. Our service is engineered to support your projects with high performance, reliability, and multi-network compatibility. It is also continuously updated to reflect the growing needs of Starknet developers.

This guide shows how to get started as a beginner-to-intermediate developer, covering everything from the signup to the API key generation.

Sign up

Begin by navigating to the Nethermind Starknet RPC service landing page at Voyager.online. This is the gateway to accessing the service and obtaining your API keys.

Once on Voyager.online, begin by creating an account. Click the ‘User’ button in the top right corner to start the process.

If prompted to ‘Sign in’ and you’re a new user, choose ‘Sign up’ at the bottom right. Enter your details, including your name and email, and set a secure password. Alternatively, sign in with OAuth through Google or Github.

Generate an API Key

To interact with the RPC service, you’ll need an API key. After logging in, hover over the ‘User’ button to access a dropdown menu of available services. Now, navigate to the ‘Services’ section in your dashboard.

Click on the ‘Create new +’ button to generate your first key.

A dialog box will appear prompting you to name your API key. Choose a name that is easy for you to identify later on.

Once generated, you’ll be shown your unique API key. This is crucial for your interactions with the Starknet network–make sure to copy, download, or store it securely. Your API key will be available in your dashboard for future reference.

Manage your API keys

Your API key will be listed on your dashboard under the ‘Services’ section. Here, you can see the name of the key, the key itself (partially hidden for security), and the option to view the endpoints.

Endpoints and documentation

You can find the documentation at docs.data.voyager.online.

The final step is to familiarize yourself with the available endpoints. Nethermind provides various endpoints for different Starknet networks, including Mainnet, Goerli, and the integration network. You can find the endpoints listed in the docs.

Simple steps to use Starknet RPC in your CLI

Accessing Starknet RPC from the command line is straightforward. Follow the instructions provided below, assuming curl is already installed on your system.

Passing your API Key

There are two ways to pass your API key when making an RPC call:

  1. Using the Header (recommended): include an HTTP header called x-apikey with your API key as its value.
curl --location 'https://rpc.nethermind.io/mainnet-juno/' \
--header 'x-apikey: YOUR_API_KEY' \
--data '{
    "jsonrpc":"2.0",
    "method":"starknet_blockNumber",
    "id":1
}'

2. Using the Query String: pass the API key as a query string parameter.

curl - location 'https://rpc.nethermind.io/mainnet-juno/?apikey=YOUR_API_KEY' \
 - data '{
 "jsonrpc":"2.0",
 "method":"starknet_blockNumber",
 "id":1
}'

Replace YOUR_API_KEY with the actual API key you received from Nethermind.

Receive the response

After executing the command with your API key, you’ll receive a response from the Starknet RPC server. A successful response will look something like this:

{
 “jsonrpc”: “2.0”,
 “result”: “0.5.1”,
 “id”: 1
}

This shows that your request was successful — in this example, the block number is the result.

Executing these steps will allow you to quickly make RPC calls to the Starknet network using Nethermind’s infrastructure. Just copy the command, replace YOUR_API_KEY with your actual API key, and you're set to go!

Please note that WebSocket Secure (WSS) is also supported, allowing for interactive communication sessions between the browser and the server!

Conclusion

Nethermind’s Starknet RPC service is designed with developers in mind, offering a robust infrastructure with dedicated support. By following these steps, you can quickly set up your account, generate an API key, and begin developing your applications with the Starknet network.

With Nethermind, you’re not only accessing a service but also the expertise of the developers behind the Juno full node, ensuring you have the support you need to build and grow your applications on Starknet.

Latest articles