Robinhood Chain testnet RPC URL and chain ID: keyless reads, WebSocket logs, faucet
Robinhood Chain testnet RPC URL https://api.blockvectra.com/v1/robinhood_testnet/public, chain ID 46630: keyless reads, WebSocket logs with an API key, faucet access, and switching the same key to mainnet.
The Robinhood Chain testnet RPC URL is https://api.blockvectra.com/v1/robinhood_testnet/public and its chain ID is 46630: keyless HTTP JSON-RPC at 3 requests per second per IP, with WebSocket logs behind an API key. Get test ETH from the testnet faucet guide. Checked .
The RPC endpoints in this guide are provided by BlockVectra; Robinhood's own public RPC endpoints and network parameters are listed in its official connection documentation.
BlockVectra serves Robinhood Chain Testnet (chain ID 46630) over JSON-RPC and WebSocket, and the same API key also works on Robinhood Chain mainnet. This guide follows the Robinhood Chain Testnet starter template through three steps: read the testnet without a key, open an account programmatically and stream logs, then move the same key to mainnet. For endpoint parameters, method policy, and tokenized stock data, see the Robinhood Chain guide.
Run the template
git clone https://github.com/blockvectra/robinhood-testnet-starter
cd robinhood-testnet-starter
npm install
npm run typecheckNode.js 18 or newer. The three scripts are npm run step1, npm run step2, and npm run step3. Optional variables (BLOCKVECTRA_API_KEY, WALLET_PRIVATE_KEY) are read from the shell; nothing loads .env automatically.
Run the complete flow
npm run walkthroughThis reads the testnet without a key, subscribes to filtered logs for 30 seconds, then uses the same API key for the mainnet RPC and Data API reads. If BLOCKVECTRA_API_KEY holds a non-empty value, it reuses that key and skips login and key creation; otherwise, without WALLET_PRIVATE_KEY, the first run saves a dedicated login wallet in .agent-wallet.json and later runs reuse that account, while each run without a key creates a new server-side key. Replace the example contract address in src/step2-key-and-logs.ts before subscribing.
The continuous command passes the key directly to the mainnet read; you do not need to copy it from masked output. If the keyless read fails, sign-up does not run. A reported subscription error stops the command before mainnet; a quiet window with no matching events does not by itself indicate failure.
Step 1: read the testnet without a key
The public endpoint https://api.blockvectra.com/v1/robinhood_testnet/public serves wallet JSON-RPC methods with no account and no API key. Query the EIP-155 chain ID directly:
curl -s "https://api.blockvectra.com/v1/robinhood_testnet/public" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}'The response is {"jsonrpc":"2.0","id":1,"result":"0xb626"}; 0xb626 is the hexadecimal chain ID, which is 46630 in decimal.
The template reads the chain entry from GET /v1/chains and builds a viem client from it, so the chain name and ID are not hard-coded. From src/shared.ts:
import { createPublicClient, defineChain, http, webSocket } from "viem";
export const API_BASE = "https://api.blockvectra.com/v1";
export interface ChainEntry {
chain: string;
name: string;
chain_id: number;
data: boolean;
ws: boolean;
subscriptions: string[];
public?: { url: string };
}
export async function getChain(slug: string): Promise<ChainEntry> {
const res = await fetch(`${API_BASE}/chains`);
if (!res.ok) throw new Error(`GET /v1/chains failed: ${res.status}`);
const { chains } = (await res.json()) as { chains: ChainEntry[] };
const entry = chains.find((c) => c.chain === slug);
if (!entry) throw new Error(`${slug} not found in /v1/chains`);
return entry;
}
export function toViemChain(entry: ChainEntry, rpcUrl: string) {
return defineChain({
id: entry.chain_id,
name: entry.name,
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
rpcUrls: { default: { http: [rpcUrl] } },
});
}
export function httpClient(entry: ChainEntry, url: string, apiKey?: string) {
return createPublicClient({
chain: toViemChain(entry, url),
transport: http(url, apiKey ? { fetchOptions: { headers: { "x-api-key": apiKey } } } : undefined),
});
}
export function wsClient(entry: ChainEntry, apiKey: string) {
const base = "wss://api.blockvectra.com/v1";
const url = `${base}/${entry.chain}/${apiKey}`;
return createPublicClient({ chain: toViemChain(entry, url), transport: webSocket(url) });
}The template’s src/step1-public-read.ts validates the catalog chain ID, then compares it with eth_chainId before reading the latest block and an address balance. Invalid catalog metadata or a mismatched network stops step 1 with a non-zero exit; npm run walkthrough then stops before sign-up:
import { formatEther, type Address } from "viem";
import { API_BASE, getChain, httpClient } from "./shared.js";
// Step 1: no account, no key. Read Robinhood Chain Testnet through the public endpoint.
const SLUG = "robinhood_testnet";
// Any address works; override with the first CLI argument.
const address = (process.argv[2] ?? "0x0000000000000000000000000000000000000000") as Address;
const chain = await getChain(SLUG);
if (!Number.isSafeInteger(chain.chain_id) || chain.chain_id <= 0) {
throw new Error(
`invalid catalog chain_id for ${SLUG}: expected a positive safe integer, got ${String(chain.chain_id)}`,
);
}
const client = httpClient(chain, `${API_BASE}/${SLUG}/public`);
// Confirm the network before any other read.
const chainId = await client.getChainId();
if (chainId !== chain.chain_id) {
throw new Error(
`chain ID mismatch for ${SLUG}: expected ${chain.chain_id} (catalog), actual ${chainId} (eth_chainId)`,
);
}
const [blockNumber, balance] = await Promise.all([
client.getBlockNumber(),
client.getBalance({ address }),
]);
console.log(`chain : ${chain.name} (${SLUG})`);
console.log(`eth_chainId : ${chainId} (0x${chainId.toString(16)})`);
console.log(`block : ${blockNumber}`);
console.log(`balance : ${formatEther(balance)} ETH (${address})`);Step 2: open an account programmatically and subscribe to logs
src/step2-key-and-logs.ts signs in with a wallet (SIWE, EIP-191) at https://console-api.blockvectra.com/v1. A first sign-in creates the account; the client then creates an API key. New accounts get 30,000,000 CU on sign-up — no credit card.
import { loadOrCreateWallet } from "./wallet.js";
const CONSOLE_API = "https://console-api.blockvectra.com/v1";
const REF = "gh-robinhood-testnet-starter";
async function post<T>(path: string, body: unknown, token?: string): Promise<T> {
const res = await fetch(`${CONSOLE_API}${path}`, {
method: "POST",
headers: { "Content-Type": "application/json", ...(token ? { Authorization: `Bearer ${token}` } : {}) },
body: JSON.stringify(body),
});
if (!res.ok) throw new Error(`${path} failed: ${res.status} ${await res.text()}`);
return (await res.json()) as T;
}
async function provisionKey(): Promise<string> {
const { account } = loadOrCreateWallet({
walletFile: ".agent-wallet.json",
privateKey: process.env.WALLET_PRIVATE_KEY,
});
console.log(`wallet: ${account.address}`);
// SIWE: ask for a challenge, sign it verbatim (EIP-191), log in. A first sign-in creates the account.
const { message } = await post<{ message: string }>("/auth/siwe/challenge", {
address: account.address,
purpose: "login",
});
const signature = await account.signMessage({ message });
const login = await post<{ session: { token: string }; account_created: boolean }>("/auth/siwe/login", {
message,
signature,
ref: REF,
});
console.log(`account_created: ${login.account_created}`);
const created = await post<{ api_key: string }>("/keys", { label: "robinhood-testnet-starter" }, login.session.token);
return created.api_key;
}
const apiKey = process.env.BLOCKVECTRA_API_KEY?.trim() || (await provisionKey());With a non-empty BLOCKVECTRA_API_KEY, step2 skips login and any wallet-file read or creation. Otherwise WALLET_PRIVATE_KEY takes precedence; an invalid value stops the run instead of falling back to the file. Without it, the first run saves a dedicated login wallet in .agent-wallet.json in the current directory, and later runs there reuse the same identity. A first sign-in for that wallet creates the account. The implementation is in src/wallet.ts.
The file contains a plaintext private key, is created with POSIX mode 0600, and matches *wallet*.json, so Git ignores it. Protect and back it up, do not commit it, do not put the key on the command line, and do not use a wallet holding funds. A damaged, invalid, unreadable, or unwritable identity stops step2 before its SIWE challenge without overwriting the file or switching to a new identity; walkthrough still performs step1 public reads first. Without an existing API key, every run creates another server-side key, keys are not automatically revoked, and reusing the account does not reuse its keys.
The WebSocket URL puts the key in the path: wss://api.blockvectra.com/v1/robinhood_testnet/{api_key}. The template checks the live ws flag and the subscriptions list from GET /v1/chains before subscribing:
Run the template's subscription implementation from this checkout. It starts the 30-second window only after eth_subscribe returns a subscription ID, then requires eth_unsubscribe to return true. Connection or subscription errors, or a failed unsubscribe, stop the walkthrough before mainnet; an empty log window alone does not prove success.
npm run step2Every logs subscription filter must include an address or a topic0; replace the example address with the contract you want to watch. See the WebSocket subscriptions guide for filter rules, close codes, and reconnection.
Step 3: switch the same key to mainnet
For a standalone mainnet read, export an existing API key and run step 3. It does not inherit a key from a finished step 2 process; use npm run walkthrough for the automatic handoff. The script uses robinhood_mainnet and calls the mainnet reader for the block number and Robinhood stock-token Data API.
export BLOCKVECTRA_API_KEY=YOUR_EXISTING_API_KEY
npm run step3The same leaderboard endpoint in curl:
curl -s -H "x-api-key: $BLOCKVECTRA_API_KEY" \
"https://api.blockvectra.com/v1/data/robinhood_mainnet/stocks"The Data API is mainnet-only: GET /v1/chains reports data: false for robinhood_testnet and data: true for robinhood_mainnet. For request parameters and response envelopes, see the Tokenized stocks guide.
Discover limits and capabilities from the API
Read GET /v1/chains for the live jsonrpc, data, ws, and subscriptions flags, the allowed JSON-RPC methods, log block ranges, state retention, and each chain's public endpoint. Read GET /v1/plans for current prices and plan limits.
curl -s "https://api.blockvectra.com/v1/chains"Related guides
- Find the testnet RPC URL and limits.
- Claim test ETH from the testnet faucet before sending transactions.
Next steps
- Browse the datasets directory to see every dataset BlockVectra indexes.
- See the free plan and pricing to check what your account includes.
- Log in to the console to create an API key.
Last updated:
HoodFi name records
Read a HoodFi name's Robinhood address with viem, select coin type 2147488311, and compare coin type 60 at the same canonical block hash.
Testnet faucet
Claim Robinhood Chain testnet ETH with your own API key (0.001 per claim). Testnet chain ID 46630, keyless RPC URL https://api.blockvectra.com/v1/robinhood_testnet/public; claim limits and error handling.