Skip to main content

Overview

Account subscriptions deliver real-time updates whenever an account’s lamport balance, data, or owner changes. You can monitor specific addresses, all accounts owned by a program, or apply byte-level data filters.

Filter Parameters

dataSize Filter

Only receive updates for accounts whose data length matches exactly:

memcmp Filter

Match accounts by a specific byte sequence at a given offset (useful for discriminators):
When combining multiple filter types, they operate as logical AND. Within account or owner arrays, values operate as logical OR.

Example: Monitor a Specific Wallet

Example: Monitor All Token Accounts by Owner Program

Optimizing with accountsDataSlice

If you only need a portion of the account data (e.g. the first 64 bytes for a discriminator), use accountsDataSlice to reduce bandwidth:

Common Use Cases