DOCUMENTATION

Code examples

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

Code examples

Client versions: TypeScript @triton-one/yellowstone-grpc 5.0.7 or later, Rust yellowstone-grpc-client 12.1 or later; both have SubscribeDeshred from those versions on. The TypeScript examples are checked against 10.0.0, the Rust ones against 13.5.1.

TypeScript

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

const client = new Client("http://fra.no-name.io:10000", process.env.NONAME_TOKEN, {
  grpcMaxDecodingMessageSize: 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: {
      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://fra.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 {
                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(())
}

TypeScript: deshredded transactions

The same transactions, before they execute (what the stream carries). Same endpoint, same token; the stream is subscribeDeshred():

import Client from "@triton-one/yellowstone-grpc";

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

const stream = await client.subscribeDeshred();
stream.on("data", (update) => {
  if (update.deshredTransaction) console.log("deshredded tx in slot", update.deshredTransaction.slot);
});
stream.on("error", (err) => { console.error(err); process.exit(1); });

stream.write({
  deshredTransactions: {
    swaps: {
      accountInclude: ["pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA"],
      accountExclude: [],
      accountRequired: [],
    },
  },
  slots: {},
});

Rust: deshredded transactions

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://fra.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_deshred().await?;
    tx.send(SubscribeDeshredRequest {
        deshred_transactions: HashMap::from([(
            "swaps".to_owned(),
            SubscribeRequestFilterDeshredTransactions {
                account_include: vec!["pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA".into()],
                ..Default::default()
            },
        )]),
        ..Default::default()
    })
    .await?;

    while let Some(update) = stream.next().await {
        if let Some(subscribe_update_deshred::UpdateOneof::DeshredTransaction(t)) = update?.update_oneof {
            println!("deshredded tx in slot {}", t.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.