-4

I've been thinking about this problem for awhile..

I'm curious if you can traverse the blocks in Solana like you can in Ethereum and get all the transaction from inception then filter out zero balance accounts.

I've been looking into it using solana-web3.js but it seems overly complex? What am I missing?

TylerH
  • 20,799
  • 66
  • 75
  • 101
gusto
  • 1

1 Answers1

1

You can achieve this by creating a Geyser plugin.

First, you must run your own Solana validator. Into this validator, you can insert a Geyser plugin by using the --geyser-plugin-config argument when you start it up. That argument takes a path to a valid configuration file.

The function you want to implement in your Geyser plugin is this one:

fn update_account(
    &mut self,
    account: ReplicaAccountInfoVersions,
    slot: u64,
    is_startup: bool,
) -> Result<()>

Every time an account changes, that function will be called. Among the changes in ReplicaAccountInfo you will find the account balance. Use this to build up your database of accounts with a non-zero balance.

For an example Geyser plugin that you can use as a basis, see the solana-accountsdb-plugin-postgres.

steveluscher
  • 4,144
  • 24
  • 42