Yellowstone gRPC

gRPC Account Filters

Subscribe to Solana account updates with fine-grained filtering via Yellowstone gRPC.

Account Filters

Subscribe to account updates with fine-grained filtering.

SubscribeRequestFilterAccounts

accountarray of strings

Account Pubkeys to monitor. Matches any pubkey in the array (logical OR).

ownerarray of strings

Account owner Pubkeys to monitor. Matches any owner in the array (logical OR).

filtersarray of SubscribeRequestFilterAccountsFilter

Additional filters (logical AND between filters):

  • memcmp - match bytes at a specific offset
  • datasize - match exact data size
  • token_account_state - filter for valid token account state
  • lamports - filter by lamport balance (eq, ne, lt, gt)
nonempty_txn_signatureboolean

Only include account updates that have a non-empty transaction signature.

Filter Types

Memcmp

Match bytes at a specific offset in account data:

message SubscribeRequestFilterAccountsFilterMemcmp {  uint64 offset = 1;  oneof data {    bytes bytes = 2;    string base58 = 3;    string base64 = 4;  }}

Lamports

Filter accounts by lamport balance:

message SubscribeRequestFilterAccountsFilterLamports {  oneof cmp {    uint64 eq = 1;  // equal to    uint64 ne = 2;  // not equal to    uint64 lt = 3;  // less than    uint64 gt = 4;  // greater than  }}

Account Update Message

accountSubscribeUpdateAccountInfo

pubkeybytes
Account public key.
lamportsuint64
Account balance in lamports.
ownerbytes
Program owner of the account.
executablebool
Whether the account contains a program.
rent_epochuint64
Next rent-due epoch.
databytes
Account data.
write_versionuint64
Write version for ordering.
txn_signaturebytes
Transaction signature that caused the update (optional).
slotuint64
Slot in which the update occurred.
is_startupbool
Whether this is an initial snapshot during startup.

Account Examples

Subscribe to a Specific Account

const request = {  accounts: {    myAccount: {      account: ["vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg"],    },  },  slots: {},  transactions: {},  transactionsStatus: {},  blocks: {},  blocksMeta: {},  entry: {},  accountsDataSlice: [],  commitment: CommitmentLevel.CONFIRMED,};

Subscribe to All Token Accounts by Owner

const request = {  accounts: {    tokenAccounts: {      owner: ["TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"],      filters: [{ datasize: 165 }],    },  },  slots: {},  transactions: {},  transactionsStatus: {},  blocks: {},  blocksMeta: {},  entry: {},  accountsDataSlice: [],  commitment: CommitmentLevel.CONFIRMED,};

Subscribe with Data Slicing

Receive only the first 32 bytes of account data to reduce bandwidth:

const request = {  accounts: {    myAccount: {      account: ["vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg"],    },  },  accountsDataSlice: [{ offset: 0, length: 32 }],  slots: {},  transactions: {},  transactionsStatus: {},  blocks: {},  blocksMeta: {},  entry: {},  commitment: CommitmentLevel.CONFIRMED,};

Filter by Lamport Balance

Monitor accounts with a balance greater than 1 SOL:

const request = {  accounts: {    richAccounts: {      owner: ["11111111111111111111111111111111"],      filters: [        { lamports: { gt: 1000000000 } },      ],    },  },  slots: {},  transactions: {},  transactionsStatus: {},  blocks: {},  blocksMeta: {},  entry: {},  accountsDataSlice: [],  commitment: CommitmentLevel.CONFIRMED,};