Monitor instructions from specific Solana programs to build program analytics or analyze instruction patterns.
Use Case
Instruction queries help you:
- Track program interactions and usage
- Monitor specific program activity
- Analyze instruction patterns
- Build program analytics dashboards
Code Example
curl --compressed -X POST 'https://portal.sqd.dev/datasets/solana-mainnet/stream' \
-H 'Content-Type: application/json' \
-d '{
"type": "solana",
"fromBlock": 280000000,
"toBlock": 280000003,
"fields": {
"block": {
"number": true,
"timestamp": true
},
"instruction": {
"programId": true,
"accounts": true,
"data": true,
"transactionIndex": true
}
},
"instructions": [{
"programId": ["whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"]
}]
}'
Try it yourself with the interactive query interface below:
Key Parameters
| Parameter | Description |
|---|
programId | Filter instructions by program address |
d8 | Filter by 8-byte instruction discriminator |
accounts | Filter by account addresses used in instruction |
data | Instruction data payload |
transactionIndex | Transaction index (use to match with transactions array) |
Expected Output
{
"header": {
"number": 259985000,
"timestamp": 1697544779
},
"instructions": [
{
"programId": "whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc",
"accounts": ["7qbRF6YsyGuLUVs6Y1q64bdVrfe4ZcUUz1JRdoVNUJnm", "..."],
"data": "base58encodeddata...",
"transactionIndex": 0
}
]
}
Filter by Instruction Discriminator
Query only specific instruction types (e.g., swap instructions):
curl --compressed -X POST 'https://portal.sqd.dev/datasets/solana-mainnet/stream' \
-H 'Content-Type: application/json' \
-d '{
"type": "solana",
"fromBlock": 280000000,
"toBlock": 280000003,
"fields": {
"instruction": {
"programId": true,
"data": true
}
},
"instructions": [{
"programId": ["whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"],
"d8": ["0xf8c69e91e17587c8"]
}]
}'
Instruction discriminators are typically the first 8 bytes of the instruction data. They identify the specific instruction type within a program.
Filter by Account
Query instructions involving specific accounts:
curl --compressed -X POST 'https://portal.sqd.dev/datasets/solana-mainnet/stream' \
-H 'Content-Type: application/json' \
-d '{
"type": "solana",
"fromBlock": 280000000,
"toBlock": 280000003,
"fields": {
"instruction": {
"programId": true,
"accounts": true
}
},
"instructions": [{
"programId": ["whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc"],
"accounts": ["7qbRF6YsyGuLUVs6Y1q64bdVrfe4ZcUUz1JRdoVNUJnm"]
}]
}'
- Combine filters: Use both
programId and d8 for specific instruction types
- Filter by accounts: Reduce results to specific program instances
- Request minimal fields: Omit
data if you don’t need instruction payload
- Use slot ranges: Process data in 10k-50k slot batches