Subscribe
Open a filtered Yellowstone gRPC stream.
Open one stream, describe what you care about with filters, and react to updates as they happen.
Client compatibility
rpc edge is Yellowstone-compatible. Bring any standard Yellowstone gRPC client and point it at:
grpc.rpcedge.com:443
frankfurt.grpc.rpcedge.com:443Authenticate with x-api-key or authorization: Bearer ... metadata.
Example
Open a stream and filter for accounts owned by the SPL Token program. The client connects over TLS
(the https://…:443 URI) and passes your UUID key as gRPC metadata.
use futures::StreamExt;
use std::collections::HashMap;
use yellowstone_grpc_client::GeyserGrpcClient;
use yellowstone_grpc_proto::geyser::{
CommitmentLevel, SubscribeRequest, SubscribeRequestFilterAccounts,
};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let mut client = GeyserGrpcClient::build_from_shared("https://grpc.rpcedge.com:443")?
.x_token(Some("YOUR_UUID_KEY"))?
.connect()
.await?;
let mut accounts = HashMap::new();
accounts.insert(
"token".to_string(),
SubscribeRequestFilterAccounts {
owner: vec!["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA".to_string()],
..Default::default()
},
);
let request = SubscribeRequest {
accounts,
commitment: Some(CommitmentLevel::Processed as i32),
..Default::default()
};
let (_tx, mut stream) = client.subscribe_with_request(Some(request)).await?;
while let Some(update) = stream.next().await {
println!("{:?}", update?);
}
Ok(())
}import Client, { CommitmentLevel } from "@triton-one/yellowstone-grpc";
const client = new Client("https://grpc.rpcedge.com:443", "YOUR_UUID_KEY", undefined);
const stream = await client.subscribe();
stream.on("data", (data) => console.log(data));
stream.write({
accounts: {
token: {
owner: ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"],
account: [],
filters: [],
},
},
accountsDataSlice: [],
slots: {},
transactions: {},
transactionsStatus: {},
blocks: {},
blocksMeta: {},
entry: {},
commitment: CommitmentLevel.PROCESSED,
});Filters
Filtering happens server-side, so you only receive what is relevant. Filter accounts by owner program or key, and transactions by account inclusion. Keep filters narrow at launch and widen only after you can drain the stream without queue growth.
Commitments
Use processed when latency matters most and you can tolerate rollback risk. Use confirmed or
finalized when you need a stronger commitment and can tolerate later delivery.