logsSubscribe - Solana

logsSubscribe. Enables developers to subscribe to real-time logs for specific transactions or events

logsSubscribe - solana [Value: 10CU]
Allows to subscribe to updates for changes in the block
Use cases

Use cases

  • Subscribe to specific log events for an account
  • Monitor on-chain events related to a particular address
  • Receive real-time notifications of account activities
Constraints

Constraints

  • Requires WebSocket connection to remain active
  • Potential delays in receiving real-time updates
  • Subscription may be terminated if not maintained
Get started
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
wscat -c wss://solana.drpc.org \
# wait for connection
{"jsonrpc": "2.0", "id": 1, "method": "logsSubscribe", "params": [{"mentions": ["E645TckHQnDcavVv92Etc6xSWQaq8zzPtPRGBheviRAk"]}, {"commitment": "finalized"}]}
Copy
Response
200
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "subscription_id"
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersobject
object
filtersobject
Specifies the criteria for receiving log results based on the type of transaction or account involved. Only one filter can be applied per method call.
object
allstring
Subscribes to all transactions except for simple vote transactions.
allWithVotesstring
Subscribes to all transactions, including simple vote transactions.
mentionsobject
An object allowing subscription to all transactions that mention a specific public key. The 'mentions' field supports only one public key (encoded as a base-58 string) per method call. Listing additional addresses will result in an error.
object
Pubkeystring
The public key of the account to monitor, encoded as a base-58 string.
encodingstring
Specifies the format for the returned account data. The available options are 'base58', 'base64', 'base64+zstd', and 'jsonParsed'.
  • base58 - This format is slower and is typically used for small amounts of data.
  • base64 - A more common encoding format that is faster and suitable for larger amounts of data.
  • base64+zstd - Base64 encoding with Zstandard compression for efficiency.
  • jsonParsed - Returns the data in a parsed JSON format, useful for human-readable output.
commitmentstring
Defines the level of assurance required for the data returned by the query.
  • finalized - The query returns 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 - The query returns the most recent block that has been voted on by the supermajority of the cluster.
  • processed - The query returns its most recent block, though the block may not be complete.

Response

200
Returns by the subscription, including the subscription ID and log data

Response params

object
idinteger
jsonrpcstring
resultobject
object
logsobject
The object containing the logs data emitted by transactions that match the subscription criteria.
object
signaturestring
The transaction signature associated with the logs.
logsarray
An array of log messages emitted by the transaction.
errobject
Error if transaction failed, null if transaction succeeded