> ## 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, Hyperliquid, x402), you can use it as-is - JSON-RPC uses the same key.

> [card] [Vibe Coders](https://goldrush.dev/platform/auth/register/?plan=vibe)
>
> \$10/mo - Built for solo builders and AI-native workflows.

> [card] [Teams](https://goldrush.dev/platform/auth/register/?plan=professional)
>
> \$250/mo - Production-grade with 50 RPS and priority support.

## 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.

## 2. Pick a chain

The endpoint shape is:

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

Replace `{chain}` with one of the [supported chain slugs](https://goldrush.dev/docs/goldrush-json-rpc/supported-chains.md). 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).

```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)
```

## 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`):

```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"])
```

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

## 4. Where to next

> [card] [Authentication details](https://goldrush.dev/docs/goldrush-json-rpc/authentication.md)
>
> Header reference, error codes, key rotation tips.

> [card] [Method reference](https://goldrush.dev/docs/api-reference/json-rpc/chains/ethereum.md)
>
> Every method with parameters, returns, and code examples per chain. See the [Solana method reference](https://goldrush.dev/docs/api-reference/json-rpc/chains/solana.md) for Solana.

> [card] [Endpoint details](https://goldrush.dev/docs/goldrush-json-rpc/edge-tier.md)
>
> Archive, `debug_*`, `trace_*`, SLA.

> [card] [Migration guides](https://goldrush.dev/docs/goldrush-json-rpc/migrating-from-other-providers.md)
>
> Coming from Infura, Alchemy, or Ankr.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.