Solana infrastructure, included with every server. LEARN MORE>

OpenInfra.shopeninfra.sh

Quickstart

Create an API key and make an authenticated Mainnet RPC request.

  1. Create an API key

    Sign in, open a project, and create a key from its Solana page. The key is shown once, so store it in a secret manager or environment variable.

    export OPENINFRA_API_KEY=sk_live_xxxxxxxxxxxx
  2. Make your first request

    Fetch the current slot using getSlot:

    import { Connection } from "@solana/web3.js"; const conn = new Connection("https://rpc.sol.openinfra.sh", {  commitment: "confirmed",  httpHeaders: { "x-api-key": process.env.OPENINFRA_API_KEY! },}); console.log("Current slot:", await conn.getSlot());

    Expected JSON-RPC response shape:

    { "jsonrpc": "2.0", "result": 312445981, "id": 1 }
  3. Subscribe over WebSockets

    Connect to the separate WebSocket endpoint and authenticate with either the x-api-key upgrade header or the verified api-key query parameter:

    const key = process.env.OPENINFRA_API_KEY;const ws = new WebSocket("wss://ws.sol.openinfra.sh?api-key=" + encodeURIComponent(key)); ws.onopen = () => {  ws.send(JSON.stringify({    jsonrpc: "2.0",    id: 1,    method: "slotSubscribe",  }));}; ws.onmessage = (event) => {  const message = JSON.parse(event.data);  console.log(message);};
  4. Choose a streaming API

    Use Yellowstone gRPC for filterable Solana account and transaction updates, or Datastream and Eventstream for OpenInfra topic streams.