Solana log subscriptions use mentions as an array. Why does specifying multiple addresses cause an error?
When writing a Solana transaction listener, the mentions field in logsSubscribe looks like a list of addresses. However, the official documentation specifies that this filter accepts only one address at a time. Providing multiple public keys returns an invalid parameter error; you can’t use this array to subscribe to multiple addresses at once.
If your application only needs to monitor a small number of addresses, you can create a separate subscription for each address and then combine the notifications. Suppose the same transaction involves two monitored addresses; both subscriptions may send a notification. When counting transactions, you can deduplicate by transaction signature and keep track of which monitored addresses it matched. This way, the transaction is counted only once overall, while you can still query the records associated with each address.
When storing the data, you can retain the two fields “transaction signature” and “matched address.” If the same signature corresponds to multiple addresses, it indicates overlap in the monitoring scopes. During reconciliation, payments and receipts should still be determined based on the actual execution results and asset changes. Matching the log filter criteria only adds the transaction to the list of items pending verification.
Original documentation https://solana.com/developers/docs/rpc/websocket/logssubscribe