Decoding · November 18, 2026 · 6 min read

Filter early, filter cheap: placing the program filter in your pipeline

A raw feed hands you every transaction, and most pipelines keep a small share of them. Where you discard the rest decides both your CPU bill and what you silently miss.

Filter right after you parse each transaction, before you resolve lookup tables. At that point the top-level program IDs are already known, because Solana requires them to be static keys, so a program filter misses no top-level call there. Filters on other accounts are different: some keys hide in lookup tables, so apply those only after resolution.

What you can filter on at each stage#

Each stage of a decoding pipeline knows a little more than the one before it, and costs more to run. A filter belongs at the earliest stage that already holds the field it tests.

StageWhat you know thereWhat a filter at this stage can testWhat it costs to reach
PacketSlot, shred index, FEC setSlot ranges onlyAlmost nothing
EntryThe ordered transactions of a batchNothing about content yetRecovery and deshredding
Parsed transactionSignatures, static account keys, the program of each top-level instruction, the message formatProgram IDs, the fee payer, any static keyParsing the message header and key list
Resolved transactionThe full account list, including keys from lookup tablesAny account the transaction touchesLookup table state, kept current
Decoded instructionArguments, named accountsAmounts, mints, pools, instruction namesLayouts or IDLs per program
Confirmed outcomeSuccess or failure, balances, logsAnything about the resultAn RPC call or stream per transaction

The parsed transaction stage is the sweet spot for the first cut. It is cheap to reach, and for most workloads the question "does this transaction call a program I care about?" removes the bulk of the traffic.

Why program IDs are safe to check early#

In a v0 message, the program of every top-level instruction must be one of the static account keys. The Solana SDK's own validation says so plainly: program ids cannot be loaded from a lookup table, so that tools can inspect a transaction's programs without loading any chain data. Legacy messages have no lookup tables at all, and neither do v1 transactions under SIMD-0385.

So a program ID filter applied right after parsing sees every top-level call, in every format, with no state. That is a strong guarantee, and it is the reason this filter can safely sit first. Filtering by program ID has the code; the program IDs page lists the common ones with their sources.

The lookup table catch: accounts you cannot see yet#

The same guarantee does not hold for other accounts. A v0 transaction can reference a pool, a token account or a wallet through a lookup table, by index only. Until you resolve the table, those keys are not in your hands.

If your filter is "transactions that touch wallet W" and W sits in a lookup table, a filter placed before resolution drops the transaction and you never know. The lookup table problem explains why that resolution needs account state from outside the packet.

The practical consequence: program filters go first, account filters go after resolution. If resolving every transaction is too expensive, resolve only the ones that already passed the program filter.

False negatives and how to count them#

Even a correctly placed program filter has blind spots, and you should count them rather than hope they are small.

  • Calls made from inside another program. If program A calls your target program B through a cross-program invocation, B never appears as a top-level instruction. Raw transactions do not contain inner instructions, which are produced only when the transaction executes. A filter on B misses these entirely.
  • Unknown lookup tables. An account filter after resolution still misses transactions whose lookup table you could not load in time.
  • Programs you forgot. A protocol that deploys a new program version under a new ID falls outside a hard-coded list.

To measure the first two, sample a small share of the transactions your filter rejected, fetch their confirmed versions through RPC, and check whether any of them involved your target. That gives you an observed miss rate instead of a guess.

A two-stage filter design#

  1. Parse each transaction's header, static keys and top-level instructions. Keep it if any instruction's program is on your list; otherwise drop it immediately.
  2. For the survivors, resolve lookup tables and build the full account list.
  3. Apply account filters (wallets, pools, mints) to the full list.
  4. Decode instructions only for transactions that pass both stages.
  5. Record how many transactions each stage dropped, and run the sampled miss check from the previous section daily.
  6. If your workload depends on calls made from inside other programs, add the wrapping programs to the stage 1 list, and treat the result as a candidate to confirm later.

What no filter placement can recover#

Placement decides what you discard. It cannot add information the transaction does not carry. Inner calls, execution results and the actual output of a swap are missing from raw transactions at every stage, and only confirmed data supplies them. If your workload is defined by what happened inside execution rather than by what was requested, raw shreds plus a filter will always under-count, and a source that delivers executed data fits better.

Keep reading#

The decoding pipeline stages show where each of these steps lives in code. What decoding costs in CPU explains how to measure what a filter saves you, using your own servers. To try the two-stage design on real traffic, a Standard Shreds destination carries the raw stream to your server.

Reading a composed transaction in order shows what a single program filter can miss when one transaction calls several programs.

Sources#

Raw shreds on your own server

Ultra Low Latency Shreds is $200 and Standard Shreds is $100. You pay in crypto, tell us which IPv4 address and UDP port should receive the stream, and we wire it up by hand.

Read nextYour decoder will meet garbage: fuzzing a Solana transaction parser