logsSubscribe
(Subscription Websocket) Subscribe to transaction logging.
This method will use 20 Compute Units.
Parameters
filtersstring. The filter criteria for the logs to receive results by account type. Only one of the following filter can be passed at a time. The following filters types are currently supported:allstring. Subscribe to all transactions except for simple vote transactions.allWithVotesstring. Subscribe to all transactions including simple vote transactions.objectobject. An object with the following field:mentionsarray. Subscribe to all transactions that mention the provided Pubkey (as base-58 encoded string). The mentions field currently only supports one Pubkey string per method call. Listing additional addresses will result in an error.
encodingstring. The encoding format for account data. It can be one of base58 (slow), base64, base64+zstd or jsonParsed.objectoptional. Configuration object containing the following fields:commitmentstring. The level of commitment required for the query. The options include:finalizedstring. The node will query the most recent block confirmed by the supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized.confirmedstring. The node will query the most recent block that has been voted on by the supermajority of the cluster.processedstring. The node will query its most recent block. Note that the block may not be complete.
Returns
result integer. The result will be an RpcResponse JSON object with id equal to the subscription id (needed to unsubscribe).
Notification Format: object. The notification will be an RpcResponse JSON object with value equal to:
signaturestring. The transaction signature base58 encoded.errobject. Error if transaction failed, null if transaction succeeded.logsarray. An array of log messages the transaction instructions output during execution, null if simulation failed before the transaction was able to execute (for example due to an invalid blockhash or signature verification failure).
// Result
{ "jsonrpc": "2.0", "result": 24040, "id": 1 }wscat -c wss://mainnet.solana.validationcloud.io/v1/<YOUR_API_KEY_HERE>
# wait for connection
{"jsonrpc": "2.0", "id": 1, "method": "logsSubscribe", "params": [{"mentions": ["Ec37CQZjwRgGnuMmUi3BnEBXS5Xa3siakAPxPkHtahSf"]}, {"commitment": "finalized"}]}
wscat -c wss://devnet.solana.validationcloud.io/v1/<YOUR_API_KEY_HERE>
# wait for connection
{"jsonrpc": "2.0", "id": 1, "method": "logsSubscribe", "params": [{"mentions": ["E645TckHQnDcavVv92Etc6xSWQaq8zzPtPRGBheviRAk"]}, {"commitment": "finalized"}]}
Last updated
Was this helpful?