Search code examples
solana

search solana address which meets conditions


Is it possible to search solana address which meets all the following conditions?

  • address starts with specific letters
  • address ends with specific letters
  • specific token balance is specific number at a specific point in the past

Solution

  • None of these are possible with the normal JSON RPC calls provided by a Solana node, but you have two options that you can develop.

    • Create an accounts plugin that tracks what you need: addresses with certain start / end letters, and token balances. More information about how to develop an accounts plugin at https://github.com/solana-labs/solana-accountsdb-plugin-postgres
    • Add options to solana-ledger-tool to get accounts based on address start and end. Currently it just prints out all the accounts by running solana-ledger-tool accounts -l my-ledger, but you could put in a PR to add some filters for the start and end letters in base-58 encoding. The source code for it can be found at https://github.com/solana-labs/solana/tree/master/ledger-tool. Note that this requires a validator ledger, which would require you to run your own node.