> ## Documentation Index
> Fetch the complete documentation index at: https://goldrush.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# JSON-RPC Quickstart

> Make your first GoldRush JSON-RPC call. From getting an API key to a balance fetch in under a minute.

## Prerequisites

Using any of the GoldRush developer tools requires an API key. If you already have a GoldRush key for any other GoldRush product (Foundational, Streaming, Pipeline, Hyperliquid, x402), you can use it as-is - JSON-RPC uses the same key.

<CardGroup cols={2}>
  <Card icon="wand-magic-sparkles" title="Vibe Coders" href="https://goldrush.dev/platform/auth/register/?plan=vibe">
    \$10/mo - Built for solo builders and AI-native workflows.
  </Card>

  <Card icon="users" title="Teams" href="https://goldrush.dev/platform/auth/register/?plan=professional">
    \$250/mo - Production-grade with 50 RPS and priority support.
  </Card>
</CardGroup>

## 1. Export your API key

```bash theme={null}
export GOLDRUSH_API_KEY="cqt_..."
```

<Warning>
  Never commit your API key to source control. Use environment variables or a secrets manager.
</Warning>

## 2. Pick a chain

The endpoint shape is:

```
https://rpc.goldrushdata.com/v1/{chain}
```

Replace `{chain}` with one of the [supported chain slugs](/goldrush-json-rpc/supported-chains). For Ethereum mainnet, that's `eth-mainnet`; for Solana, that's `solana-mainnet`.

## 3. Make a request

The examples below target an EVM chain. For Solana, jump to [step 3 (Solana)](#3-make-a-request-solana).

<CodeGroup>
  ```bash curl theme={null}
  curl https://rpc.goldrushdata.com/v1/eth-mainnet \
    -H "Authorization: Bearer $GOLDRUSH_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "eth_blockNumber",
      "params": []
    }'
  ```

  ```typescript ethers v6 theme={null}
  import { ethers } from "ethers";

  const url = "https://rpc.goldrushdata.com/v1/eth-mainnet";
  const fetchReq = new ethers.FetchRequest(url);
  fetchReq.setHeader("Authorization", `Bearer ${process.env.GOLDRUSH_API_KEY}`);

  const provider = new ethers.JsonRpcProvider(fetchReq);
  const block = await provider.getBlockNumber();
  console.log("latest block:", block);
  ```

  ```typescript viem theme={null}
  import { createPublicClient, http } from "viem";
  import { mainnet } from "viem/chains";

  const client = createPublicClient({
    chain: mainnet,
    transport: http("https://rpc.goldrushdata.com/v1/eth-mainnet", {
      fetchOptions: {
        headers: {
          Authorization: `Bearer ${process.env.GOLDRUSH_API_KEY}`,
        },
      },
    }),
  });

  const block = await client.getBlockNumber();
  console.log("latest block:", block);
  ```

  ```javascript web3.js theme={null}
  import { Web3 } from "web3";

  const provider = new Web3.providers.HttpProvider(
    "https://rpc.goldrushdata.com/v1/eth-mainnet",
    {
      headers: [
        { name: "Authorization", value: `Bearer ${process.env.GOLDRUSH_API_KEY}` },
      ],
    }
  );
  const web3 = new Web3(provider);
  const block = await web3.eth.getBlockNumber();
  console.log("latest block:", block);
  ```

  ```python web3.py theme={null}
  from os import environ
  from web3 import Web3

  w3 = Web3(Web3.HTTPProvider(
      "https://rpc.goldrushdata.com/v1/eth-mainnet",
      request_kwargs={
          "headers": {
              "Authorization": f"Bearer {environ['GOLDRUSH_API_KEY']}",
          },
      },
  ))
  print("latest block:", w3.eth.block_number)
  ```
</CodeGroup>

## 3. Make a request (Solana)

On Solana, the same endpoint shape and header auth apply; only the methods change. Here's a `getSlot` call (the Solana equivalent of `eth_blockNumber`):

<CodeGroup>
  ```bash curl theme={null}
  curl https://rpc.goldrushdata.com/v1/solana-mainnet \
    -H "Authorization: Bearer $GOLDRUSH_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getSlot",
      "params": [{ "commitment": "finalized" }]
    }'
  ```

  ```typescript @solana/kit theme={null}
  import {
    createDefaultRpcTransport,
    createSolanaRpcFromTransport,
  } from "@solana/kit";

  const transport = createDefaultRpcTransport({
    url: "https://rpc.goldrushdata.com/v1/solana-mainnet",
    headers: { Authorization: `Bearer ${process.env.GOLDRUSH_API_KEY}` },
  });
  const rpc = createSolanaRpcFromTransport(transport);

  const slot = await rpc.getSlot().send();
  console.log("current slot:", slot);
  ```

  ```typescript @solana/web3.js theme={null}
  import { Connection } from "@solana/web3.js";

  const connection = new Connection(
    "https://rpc.goldrushdata.com/v1/solana-mainnet",
    {
      httpHeaders: {
        Authorization: `Bearer ${process.env.GOLDRUSH_API_KEY}`,
      },
    }
  );

  const slot = await connection.getSlot("finalized");
  console.log("current slot:", slot);
  ```

  ```python python theme={null}
  import os
  import requests

  resp = requests.post(
      "https://rpc.goldrushdata.com/v1/solana-mainnet",
      headers={
          "Authorization": f"Bearer {os.environ['GOLDRUSH_API_KEY']}",
          "Content-Type": "application/json",
      },
      json={"jsonrpc": "2.0", "id": 1, "method": "getSlot", "params": [{"commitment": "finalized"}]},
  )
  print("current slot:", resp.json()["result"])
  ```
</CodeGroup>

New to Solana RPC? See [Solana concepts](/goldrush-json-rpc/solana-concepts) for commitment levels, slots vs blocks, lamports, and encodings.

## 4. Where to next

<CardGroup cols={2}>
  <Card title="Authentication details" href="/goldrush-json-rpc/authentication" icon="key">
    Header reference, error codes, key rotation tips.
  </Card>

  <Card title="Method reference" href="/api-reference/json-rpc/chains/ethereum" icon="book-open">
    Every method with parameters, returns, and code examples per chain. See the [Solana method reference](/api-reference/json-rpc/chains/solana) for Solana.
  </Card>

  <Card title="Endpoint details" href="/goldrush-json-rpc/edge-tier" icon="bolt">
    Archive, `debug_*`, `trace_*`, SLA.
  </Card>

  <Card title="Migration guides" href="/goldrush-json-rpc/migrating-from-other-providers" icon="right-left">
    Coming from Infura, Alchemy, or Ankr.
  </Card>
</CardGroup>
