Overview
Yellowstone gRPC provides powerful filtering capabilities to narrow down the stream of updates you receive. Filters work as logical operations:- Within a filter: Fields work as logical
AND - Within arrays: Values work as logical
OR - Exception: Filter arrays (like
memcmpfilters) work as logicalAND
Account Filters
Account filters allow you to subscribe to specific accounts or accounts matching certain criteria.Filter by Account Pubkey
Subscribe to specific account addresses:Filter by Owner Pubkey
Subscribe to all accounts owned by specific programs:Advanced Account Filters
Yellowstone supports the same filter types asgetProgramAccounts:
- Memcmp Filter
- Data Size Filter
- Token Account State
- Lamports Filter
Filter by comparing bytes at a specific offset in account data:Memcmp Data Formats:TypeScript Example:
Combining Account Filters
Multiple filters work as logicalAND - an account must match all filters:
Nonempty Transaction Signature
Filter for accounts that have a transaction signature (updated within a transaction):Transaction Filters
Transaction filters let you subscribe to specific transactions or transactions involving certain accounts.Vote and Failed Filters
vote: Some(true)- Only vote transactionsvote: Some(false)- Exclude vote transactionsvote: None- Include both vote and non-vote transactions
failed field.
Filter by Specific Signature
Account Include Filter
Match transactions that include ANY of the specified accounts:Account Exclude Filter
Exclude transactions that use any of the specified accounts:Account Required Filter
Match transactions that include ALL of the specified accounts:Block Filters
Block filters control which block data you receive:Basic Block Filter
Filter Blocks by Account Activity
Only receive blocks that have activity for specific accounts:Slot Filters
Slot filters are simpler and control slot update behavior:filter_by_commitment: Whentrue, only receive slots matching your commitment level. Whenfalse, receive all slot status updates.interslot_updates: Whentrue, receive intermediate slot updates (FIRST_SHRED_RECEIVED, COMPLETED, CREATED_BANK, etc.)
Practical Examples
Monitor USDC token accounts with balance > 1000 USDC
Monitor USDC token accounts with balance > 1000 USDC
Track all transactions for a specific wallet
Track all transactions for a specific wallet
Monitor swap transactions on a specific DEX
Monitor swap transactions on a specific DEX
Get blocks with specific program activity
Get blocks with specific program activity
Filter Limits
Servers can impose limits on filters to prevent abuse. Check with your gRPC provider for specific limits. Example server-side limits:Next Steps
- Use Data Slicing to receive only parts of account data
- Learn about Commitment Levels for filtering by confirmation status
- Understand Subscribing for the basics of subscriptions