Connection samples
Copy-paste samples for your endpoints. Replace YOUR_API_KEY with the key from your dashboard, and keep it in an environment variable or a secret store rather than in source code.
JSON-RPC
Send the key in the x-api-key header. The call below reads the current slot.
curl
Frankfurt (default)
bash
curl --fail-with-body 'https://rpc.sol.flashland.dev' \
-H 'Content-Type: application/json' \
-H 'x-api-key: YOUR_API_KEY' \
-d '{"jsonrpc":"2.0","id":1,"method":"getSlot","params":[]}'New York
bash
curl --fail-with-body 'https://rpc.nyc.sol.flashland.dev' \
-H 'Content-Type: application/json' \
-H 'x-api-key: YOUR_API_KEY' \
-d '{"jsonrpc":"2.0","id":1,"method":"getSlot","params":[]}'TypeScript
Frankfurt (default)
typescript
const response = await fetch("https://rpc.sol.flashland.dev", {
method: "POST",
headers: {"content-type":"application/json","x-api-key":"YOUR_API_KEY"},
body: JSON.stringify({"jsonrpc":"2.0","id":1,"method":"getSlot","params":[]}),
signal: AbortSignal.timeout(20_000),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
if (data.error) throw new Error("RPC request failed");
console.log(data.result);New York
typescript
const response = await fetch("https://rpc.nyc.sol.flashland.dev", {
method: "POST",
headers: {"content-type":"application/json","x-api-key":"YOUR_API_KEY"},
body: JSON.stringify({"jsonrpc":"2.0","id":1,"method":"getSlot","params":[]}),
signal: AbortSignal.timeout(20_000),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
if (data.error) throw new Error("RPC request failed");
console.log(data.result);Python
Frankfurt (default)
python
import requests
response = requests.post(
"https://rpc.sol.flashland.dev",
headers={"Content-Type":"application/json","x-api-key":"YOUR_API_KEY"},
json={"jsonrpc":"2.0","id":1,"method":"getSlot","params":[]},
timeout=20,
)
response.raise_for_status()
data = response.json()
if "error" in data:
raise RuntimeError("RPC request failed")
print(data["result"])New York
python
import requests
response = requests.post(
"https://rpc.nyc.sol.flashland.dev",
headers={"Content-Type":"application/json","x-api-key":"YOUR_API_KEY"},
json={"jsonrpc":"2.0","id":1,"method":"getSlot","params":[]},
timeout=20,
)
response.raise_for_status()
data = response.json()
if "error" in data:
raise RuntimeError("RPC request failed")
print(data["result"])WebSocket
A subscription on the WebSocket endpoint, with the key in the x-api-key header.
Frankfurt (default)
typescript
import WebSocket from "ws";
const ws = new WebSocket("wss://ws.sol.flashland.dev", {
headers: {"x-api-key":"YOUR_API_KEY"},
});
ws.on("open", () => ws.send(JSON.stringify({"jsonrpc":"2.0","id":1,"method":"slotSubscribe"})));
ws.on("message", (data) => console.log(data.toString()));New York
typescript
import WebSocket from "ws";
const ws = new WebSocket("wss://ws.nyc.sol.flashland.dev", {
headers: {"x-api-key":"YOUR_API_KEY"},
});
ws.on("open", () => ws.send(JSON.stringify({"jsonrpc":"2.0","id":1,"method":"slotSubscribe"})));
ws.on("message", (data) => console.log(data.toString()));Yellowstone gRPC
A streaming subscription with the Yellowstone client.
Frankfurt (default)
typescript
import Client, { CommitmentLevel } from "@triton-one/yellowstone-grpc";
const client = new Client("geyser.sol.flashland.dev:443", "YOUR_API_KEY", {
"grpc.max_receive_message_length": 64 * 1024 * 1024,
});
await client.connect();
const stream = await client.subscribe();
stream.on("data", (update) => console.log(update));
await new Promise<void>((resolve, reject) => {
stream.write(
{
slots: { client: {} },
accounts: {},
transactions: {},
transactionsStatus: {},
blocks: {},
blocksMeta: {},
entry: {},
accountsDataSlice: [],
commitment: CommitmentLevel.CONFIRMED,
},
(err) => (err ? reject(err) : resolve()),
);
});New York
typescript
import Client, { CommitmentLevel } from "@triton-one/yellowstone-grpc";
const client = new Client("geyser.nyc.sol.flashland.dev:443", "YOUR_API_KEY", {
"grpc.max_receive_message_length": 64 * 1024 * 1024,
});
await client.connect();
const stream = await client.subscribe();
stream.on("data", (update) => console.log(update));
await new Promise<void>((resolve, reject) => {
stream.write(
{
slots: { client: {} },
accounts: {},
transactions: {},
transactionsStatus: {},
blocks: {},
blocksMeta: {},
entry: {},
accountsDataSlice: [],
commitment: CommitmentLevel.CONFIRMED,
},
(err) => (err ? reject(err) : resolve()),
);
});