logSubscribe RPC Method
Parameters
filters
The filter criteria for the logs to receive results by account type. The currently supported filters are:
encoding
The encoding format for account data. It can be one of base58 (slow), base64, base64+zstd or jsonParsed
object
array
An object with the following fields:
commitment
string
The level of commitment required for the query. The options include:
finalized
string
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
confirmed
string
The node will query the most recent block that has been voted on by the supermajority of the cluster
processed
string
The node will query its most recent block. Note that the block may not be complete
Returns
result
The result will be an RpcResponse JSON object with id equal to the subscription id (needed to unsubscribe)
Notification Format:
The notification will be an RpcResponse JSON object with value equal to
signature
The notification will be an RpcResponse JSON object with value equal to:
err
Error if transaction failed, null if transaction succeeded
logs
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)
Request
1const web3 = require("@solana/web3.js");2(async () => {3const publicKey = new web3.PublicKey(4"E645TckHQnDcavVv92Etc6xSWQaq8zzPtPRGBheviRAk"5);6const solanaConnection = new web3.Connection("https://docs-demo.solana-mainnet.quiknode.pro/", {7wsEndpoint: "",8});9solanaConnection.onLogs(10publicKey,11(logs, context) => console.log("Updated account info: ", logs),12"confirmed"13);14})();15
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free