gRPC Subscription Filters

The Subscribe method accepts filters for different data types. Each filter streams specific on-chain data in real-time directly from the Solana validator with sub-millisecond latency.

Available Subscriptions

SubscriptionDescriptionCommon Use Case
AccountsReal-time account state changesToken balances, program state, wallet monitoring
TransactionsIndividual transactions as processedDEX trade monitoring, copy trading, MEV
TransactionStatusTransaction confirmation statusConfirmation tracking without full tx data
BlocksComplete block data with transactionsBlock explorers, full indexing
BlockMetaBlock metadata without transaction detailsSlot monitoring, block timing
SlotsSlot progression notificationsLeader tracking, timing synchronization
EntriesLedger entry dataAdvanced analytics, validator monitoring
ProgramsProgram deployment and upgrade eventsProtocol monitoring, security alerts

How Subscriptions Work

All subscriptions are multiplexed through a single bidirectional gRPC stream opened by the Subscribe method. You can combine multiple subscription types in a single request — for example, monitoring specific accounts while also tracking slot progression.

Each subscription filter has a label (the key in the map). When an update matches your filter, the response includes which labels matched, so you can route updates to the correct handler.

Quick Example

1const stream = client.subscribe(new grpc.Metadata());
2
3stream.on('data', (update) => {
4  if (update.account) {
5    console.log('Account update:', Buffer.from(update.account.account.pubkey).toString('hex'));
6  } else if (update.transaction) {
7    console.log('Transaction:', Buffer.from(update.transaction.transaction.signature).toString('hex'));
8  } else if (update.slot) {
9    console.log('Slot:', update.slot.slot, 'Status:', update.slot.status);
10  }
11});
12
13// Subscribe to Raydium accounts + all slots
14stream.write({
15  accounts: {
16    raydium: {
17      account: [],
18      owner: ['675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8'],
19      filters: []
20    }
21  },
22  slots: { allSlots: {} },
23  transactions: {},
24  blocks: {},
25  blocksMeta: {},
26  commitment: 1,
27  entry: {},
28  accountsDataSlice: [],
29  ping: null
30});

Commitment Levels

ValueLevelLatencyRecommendation
0ProcessedLowestHFT bots, snipers, real-time UIs
1ConfirmedMediumMost applications
2FinalizedHighestExchanges, settlement systems