Overview
Transaction monitoring enables you to track transaction execution, success/failure status, program interactions, and token balance changes across Solana in real-time. This guide covers filtering strategies and practical implementations for different transaction monitoring use cases.Prerequisites: This guide assumes you’ve completed the Yellowstone gRPC Quickstart and have a working stream setup.
Transaction Filtering Options
Monitor transactions involving specific programsTrack all transactions that interact with your programs:
Best for: Program-specific monitoring, DeFi protocol tracking, smart contract interactions
Practical Examples
Example 1: Monitor DEX Transactions
Track all transactions involving popular DEX programs:Example 2: Monitor Failed Transactions
Track failed transactions to identify issues:Example 3: Monitor High-Value Transactions
Track transactions with significant SOL transfers:Transaction Data Structure
Understanding the transaction data structure helps extract relevant information:Transaction Message Structure
Transaction Message Structure
Core transaction data:
Token Balance Changes
Token Balance Changes
Token balance structure:
Instruction Details
Instruction Details
Program instruction structure:
Filter Logic Reference
Include Logic (OR)
accountInclude: Transaction must involve ANY of these accountsExample:
["A", "B"]
matches transactions involving account A OR account BRequired Logic (AND)
accountRequired: Transaction must involve ALL of these accountsExample:
["A", "B"]
matches transactions involving account A AND account BExclude Logic (NOT)
accountExclude: Transaction must NOT involve any of these accountsExample:
["A", "B"]
excludes transactions involving account A or account BCombined Logic
Final filter:
(accountInclude OR empty) AND (accountRequired AND all) AND NOT (accountExclude OR any)
Performance Considerations
Transaction streams can be high-volume
- Start with specific program filters
- Use commitment levels appropriately
- Monitor your processing capacity
- Implement backpressure handling
Error Handling
Common transaction monitoring errors and solutions:Too Many Transactions
Too Many Transactions
Error: Overwhelming transaction volumeSolutions:
- Add more specific filters (accountRequired, accountExclude)
- Use higher commitment levels to reduce volume
- Implement sampling or rate limiting
- Process transactions asynchronously
Missing Transactions
Missing Transactions
Error: Expected transactions not appearingSolutions:
- Verify program addresses are correct
- Check if transactions actually occur
- Try PROCESSED commitment for faster updates
- Ensure filters aren’t too restrictive
Parse Errors
Parse Errors
Error: Cannot parse transaction dataSolutions:
- Handle missing fields gracefully
- Validate data structure before processing
- Log problematic transactions for debugging
- Use try-catch blocks around parsing logic