Skip to main content
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

ParameterDescription
programIdFilter instructions by program address
d8Filter by 8-byte instruction discriminator
accountsFilter by account addresses used in instruction
dataInstruction data payload
transactionIndexTransaction 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"]
    }]
  }'

Performance Tips

  1. Combine filters: Use both programId and d8 for specific instruction types
  2. Filter by accounts: Reduce results to specific program instances
  3. Request minimal fields: Omit data if you don’t need instruction payload
  4. Use slot ranges: Process data in 10k-50k slot batches
Last modified on November 18, 2025