DOCUMENTATION

Code examples

Connect from TypeScript or Rust, and measure the latency you actually receive.

Code examples

TypeScript

import Client, { CommitmentLevel } from "@triton-one/yellowstone-grpc";

const client = new Client("http://ams.no-name.io:10000", process.env.NONAME_TOKEN, {
  "grpc.max_receive_message_length": 64 * 1024 * 1024,
});

const stream = await client.subscribe();
stream.on("data", (update) => {
  if (update.account) console.log("account", update.filters, update.account.slot);
  if (update.transaction) console.log("tx", update.filters, update.transaction.slot);
});
stream.on("error", (err) => { console.error(err); process.exit(1); });

stream.write({
  accounts: {
    pools: {
      account: [],
      owner: ["pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA"],
      filters: [],
    },
  },
  transactions: {
    swaps: {
      vote: false,
      failed: false,
      accountInclude: ["pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA"],
      accountExclude: [],
      accountRequired: [],
    },
  },
  commitment: CommitmentLevel.PROCESSED,
  accountsDataSlice: [],
  slots: {}, blocks: {}, blocksMeta: {}, entry: {}, transactionsStatus: {},
});

Rust

use futures::{SinkExt, StreamExt};
use std::collections::HashMap;
use yellowstone_grpc_client::GeyserGrpcClient;
use yellowstone_grpc_proto::prelude::*;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let mut client = GeyserGrpcClient::build_from_static("http://ams.no-name.io:10000")
        .x_token(Some(std::env::var("NONAME_TOKEN")?))?
        .max_decoding_message_size(64 * 1024 * 1024)
        .connect()
        .await?;

    let (mut tx, mut stream) = client.subscribe().await?;
    tx.send(SubscribeRequest {
        transactions: HashMap::from([(
            "swaps".to_owned(),
            SubscribeRequestFilterTransactions {
                vote: Some(false),
                failed: Some(false),
                account_include: vec!["pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA".into()],
                ..Default::default()
            },
        )]),
        commitment: Some(CommitmentLevel::Processed as i32),
        ..Default::default()
    })
    .await?;

    while let Some(update) = stream.next().await {
        match update?.update_oneof {
            Some(subscribe_update::UpdateOneof::Transaction(t)) => println!("tx in slot {}", t.slot),
            Some(subscribe_update::UpdateOneof::Account(a)) => println!("account in slot {}", a.slot),
            _ => {}
        }
    }
    Ok(())
}

Measuring latency

The figures on the home page are live. They measure one interval: from a shred arriving to the resulting account and transaction updates being emitted on the gRPC stream — the latency a subscriber actually experiences, over a rolling one-minute window. The network transit from us to you is not included and depends on where you host.

To measure what you actually receive:

Racing NoName against another source

The feed is designed to be one input among several. Subscribe to the same filter on NoName and on your current provider, de-duplicate by transaction signature (or by account pubkey and write version from a single source), and act on whichever arrives first. That is also the fairest benchmark: count which source delivers each update first, and by how much.