in-solana by Supanode

accountSubscribe — Solana WebSocket Method

accountSubscribe sends a notification whenever the specified account’s data or lamport balance changes.

Subscribe request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "accountSubscribe",
  "params": [
    "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
    { "encoding": "jsonParsed", "commitment": "confirmed" }
  ]
}

Notification format

{
  "jsonrpc": "2.0",
  "method": "accountNotification",
  "params": {
    "result": {
      "context": { "slot": 123456789 },
      "value": {
        "lamports": 1000000,
        "data": ["base64-data", "base64"],
        "owner": "11111111111111111111111111111111",
        "executable": false,
        "rentEpoch": 361,
        "space": 0
      }
    },
    "subscription": 42
  }
}

FAQ

How often do notifications arrive? One notification per slot in which the account changed, at the specified commitment level.

Can I subscribe to multiple accounts? Yes. Send a separate accountSubscribe for each account. Each gets its own subscription ID.

Parameters

ParameterTypeRequiredDescriptionDefault
pubkeystringYesAccount pubkey as base-58 encoded string—
configobjectNoConfiguration object with commitment and encoding—

Updated: