OpenInfra.sh is now live - Solana infrastructure, included with every server. LEARN MORE HERE >

OpenInfra.shopeninfra.sh

Transaction stream

Receive confirmed transactions the moment they land — filtered by program, account, and success status.

Subscribing

import Client, { CommitmentLevel } from "@triton-one/yellowstone-grpc";import bs58 from "bs58"; const client = new Client("grpc.openinfra.sh:10000", undefined, {  "x-token": process.env.OPENINFRA_API_KEY!,}); const stream = await client.subscribe(); await new Promise<void>((resolve, reject) =>  stream.write(    {      transactions: {        // Name this filter — write it again to update/replace        jup_swaps: {          vote: false,          failed: false,          accountInclude: [            "JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4",          ],          accountExclude: [],          accountRequired: [],        },      },      slots: {},      accounts: {},      blocks: {},      blocksMeta: {},      accountsDataSlice: [],      commitment: CommitmentLevel.CONFIRMED,    },    (err) => (err ? reject(err) : resolve())  )); stream.on("data", (data) => {  if (!data.transaction) return;  const { slot, transaction } = data.transaction;  const sig = bs58.encode(transaction.signature);  const err = transaction.meta?.err;  console.log(`slot ${slot} — ${sig} — ${err ? "failed" : "ok"}`);});

Transaction payload

Each data.transaction contains:

  • slot — slot in which the transaction was confirmed.
  • transaction.signature — raw bytes of the signature (Base58-encode for display).
  • transaction.transaction.message — account keys, instructions, and address lookup tables.
  • transaction.meta — fee, pre/post balances, log messages, inner instructions, token balances.

Reading inner instructions

stream.on("data", (data) => {  if (!data.transaction) return;  const meta = data.transaction.transaction?.meta;  const innerIxs = meta?.innerInstructions ?? [];  for (const inner of innerIxs) {    for (const ix of inner.instructions) {      console.log("inner program:", ix.programIdIndex);    }  }});

Performance notes

  • High-throughput programs (e.g. all DEX swaps) can produce hundreds of transactions per slot. Filter tightly.
  • Process data asynchronously — avoid blocking the stream's data handler with heavy computation.
  • Use a worker thread or offload to a queue for Borsh decoding or database writes.