Skip to content

[docs-agent] Add Solana historical account state snapshots guide#1303

Open
JackReacher0807 wants to merge 3 commits into
mainfrom
docs/solana-historical-account-state
Open

[docs-agent] Add Solana historical account state snapshots guide#1303
JackReacher0807 wants to merge 3 commits into
mainfrom
docs/solana-historical-account-state

Conversation

@JackReacher0807
Copy link
Copy Markdown
Collaborator

Summary

Adds a new MDX page at content/api-reference/solana/historical-account-state.mdx documenting the two supported workflows for reconstructing historical Solana account state at any cadence (hourly, daily, slot-level):

  • Workflow A — Forward snapshotting via Yellowstone gRPC. Subscribe to specific addresses or program owners, persist every SubscribeUpdateAccount keyed by (pubkey, slot), query "state at hour H" as the latest row with slot <= block_at(H). Covers filter options, the up-to-6000-slot from_slot replay window for disconnects, and how to enumerate the initial account set via paginated getProgramAccounts through Alchemy's AccountsDB Infrastructure.
  • Workflow B — Historical backfill via transaction replay. Walk an account's history with getSignaturesForAddress + getTransaction and apply each transaction's effect on the account in slot order. Covers when to combine with getProgramAccounts for program-wide state, and references the 20x archival speedup from Alchemy's Solana stack.

The page also explains the underlying Solana RPC limitation (minContextSlot is a freshness floor, not a historical at-slot read), discusses sampling-cadence trade-offs (store-every-update vs materialized rollups), and ends with a side-by-side workflow comparison table plus links to AccountsDB Infrastructure, Yellowstone gRPC, the Solana API FAQ archival section, and the Built-for-Solana blog posts.

Generic title; no customer or DeFi-protocol names in the page copy.

Nav entry added to content/docs.yml under SolanaQuickstart, immediately after Accounts DB Infrastructure.

Linear

DOCS-84 — https://linear.app/alchemyapi/issue/DOCS-84/docs-add-solana-historical-account-state-snapshots-guide

Requested by

@SahilAujla (via Slack thread)

New MDX page at content/api-reference/solana/historical-account-state.mdx covering the two supported workflows for reconstructing point-in-time Solana account state: forward snapshotting via Yellowstone gRPC subscriptions and historical backfill via getSignaturesForAddress + getTransaction replay. Includes guidance on sampling cadence, filter options, gRPC reconnect via from_slot replay, and a trade-offs comparison. Added under the Solana section in docs.yml alongside AccountsDB Infrastructure.

Refs DOCS-84

Requested-by: @SahilAujla
@JackReacher0807 JackReacher0807 requested a review from a team as a code owner May 15, 2026 17:28
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

🔗 Preview Mode

Name Status Preview Updated (UTC)
Alchemy Docs ✅ Ready 🔗 Visit Preview May 15, 2026, 6:39 PM

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f6293362b1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread content/api-reference/solana/historical-account-state.mdx Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

🔍 Link Check

Status: ❌ Failed

Summary

Status Count
🔍 Total 8227
✅ Successful 7102
⏳ Timeouts 0
🔀 Redirected 433
👻 Excluded 683
❓ Unknown 0
🚫 Errors 8
⛔ Unsupported 1
Broken links (8) — click to expand

Errors per input

Errors in ./content/wallets/wallet-integrations/privy/jwt-auth-migration.mdx

Errors in ./content/wallets/wallet-integrations/privy/signer-migration-overview.mdx

Errors in ./content/api-reference/arbitrum-nova/arbitrum-nova-deprecation-notice.mdx

Errors in ./content/wallets/pages/recipes/programmatic-wallet-creation.mdx

Errors in ./content/tutorials/smart-wallets/learn-account-abstraction/introduction-to-account-abstraction.mdx

Errors in ./content/api-reference/data/webhooks/custom-webhooks-quickstart/custom-webhooks-quickstart.mdx

Errors in ./content/wallets/pages/recipes/onramp-funds.mdx

View workflow run

Addresses codex review feedback on PR #1303: a single Solana slot can contain multiple writes to the same account, so indexing by (pubkey, slot) alone makes 'latest version at or before slot N' ambiguous and can return an earlier intra-slot state. Update the storage layout and the SQL example to use (pubkey, slot, write_version) for indexing and ORDER BY slot DESC, write_version DESC LIMIT 1 for the snapshot lookup. Add a paragraph explaining what write_version is and why the tie-break matters.

Refs DOCS-84

Requested-by: @SahilAujla
Comment thread content/api-reference/solana/historical-account-state.mdx Outdated
Addresses review feedback from @deepakbnsl on PR #1303. The original workflow B description and TypeScript example implied that getTransaction is sufficient to reconstruct arbitrary program account data, which is incorrect — getTransaction returns pre/post lamport balances, pre/post token balances, inner instructions, and log messages, but NOT pre/post account data blobs.

Changes:

* New 'What getTransaction provides' subsection enumerates what the response actually contains and explicitly notes the absence of pre/post account data fields.

* New Warning callout scoping workflow B to SOL lamport balances, SPL token balances, and program-emitted log events. Documents that arbitrary program account data reconstruction requires either a starting data snapshot + program-specific instruction decoding, or comprehensive event logs from the program.

* Rewrote the Pattern subsection to be concrete about reading meta.postBalances at the target account index, and clarified that meta.preBalances at T+1 equals meta.postBalances at the most recent earlier touching transaction so the post-side is the canonical value per slot.

* Rewrote 'When you need program-account state, not just a single account' as 'When you need program-account state, not just balances' with the correct guidance: enumerate via getProgramAccounts for current data, start workflow A for ongoing changes, treat the subscription start as the history-begins-here marker. External-snapshot bootstrap or program-side replay flagged as out-of-scope for this guide.

* Replaced the TypeScript example with a concrete lamport-balance backfill that locates the target account's index in transaction.message.accountKeys and persists meta.postBalances[i]. Added a note about extending to token balances and log events.

* Updated the workflow comparison table: 'Reconstruction effort' row replaced with 'Data captured' to clearly distinguish what each workflow returns (full account bytes vs balances + log events only).

* Updated the closing 'combine the two' paragraph to reflect the correct combined workflow.

Refs DOCS-84

Requested-by: @SahilAujla
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants