Account Changes
Last updated
Was this helpful?
Last updated
Was this helpful?
In this tutorial, you will learn how to consume Solana account change data using Substreams. We will walk you through the process of setting up your environment, configuring your first Substreams stream, and consuming account changes efficiently.
By the end of this tutorial, you will have a working Substreams feed that allows you to track real-time account changes on the Solana blockchain, as well as historical account change data.
For each Solana Account block, only the latest update per account is recorded, see the . If an account is deleted, a payload with deleted == True
is provided. Additionally, events of low importance we're omitted, such as those with the special owner “Vote11111111…” account or changes that do not affect the account data (ex: lamport changes).
The Account Changes Substreams natively handles a change of ownership upon delete.
Before you begin, ensure that you have the following:
installed.
A for access to the Solana Account Change data.
Basic knowledge of the command line interface (CLI).
Now that you have Substreams CLI installed, we can set up a connection to the Solana Account Change Substreams feed.
Using the , you can choose to stream data directly or use the GUI for a more visual experience. The following gui
example filters for Honey Token account data.
This command will benchmark the account change stream within your terminal.
The Foundational Module has support for filtering on specific accounts and/or owners. You can adjust the query based on your needs.
This tutorial will continue to guide you through filtering, sinking the data, and setting up reconnection policies.
The user's primary responsibility when creating or using a sink is to pass a BlockScopedDataHandler and a BlockUndoSignalHandler implementation(s) which has the following interface:
Consume the account stream using a callback or make it queryable by using the .
ensures seamless continuity and retraceability by allowing you to resume from the last consumed block if the connection is interrupted, preventing data loss and maintaining a persistent stream.