Start a live Solana account view without overwriting newer state

Reading a snapshot before opening a subscription leaves a window for missed account changes. Opening the stream first allows a viewer to reconcile a snapshot with updates already received.

Buffer notifications until the baseline arrives

Send this WebSocket frame for the account and wait for the subscription acknowledgement. Buffer accountNotification messages. Request getAccountInfo for the same public key over HTTP with finalized commitment, then record its result.context.slot and value.

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "accountSubscribe",
  "params": [
    "ACCOUNT_PUBLIC_KEY",
    {
      "encoding": "base64",
      "commitment": "finalized"
    }
  ]
}

Compare the snapshot slot with the buffered states

Suppose the snapshot is at slot 100 with 25 lamports and the buffer contains states at 99 and 102. Initialize the view with 25 and apply the state at 102. An update from 99 describes an earlier state. At equal slots avoid guessing an intra-slot order from the slot number alone. A fresh finalized snapshot resolves ambiguous display state.

After a disconnect, repeat the subscription and baseline read. This restores a current-state view. An audit log covering all historical transitions needs additional transaction or block data.

Documentation