How to Use getLargestAccounts
Learn getLargestAccounts use cases, code examples, request parameters, response structure, and tips.
The getLargestAccounts
RPC method returns a list of the top 20 accounts on the Solana network, ranked by their lamport balance. This method can be useful for network analysis, understanding wealth distribution, or identifying significant holders of SOL.
Note that the results from this method may be cached by the RPC node for up to two hours.
Common Use Cases
- Network Health Monitoring: Observe the concentration of SOL in the largest accounts.
- Economic Analysis: Study the distribution of wealth on the Solana network.
- Identifying Whales: Find accounts holding significant amounts of SOL.
Request Parameters
This method can optionally take a configuration object with the following parameters:
commitment
(string, optional): Specifies the commitment level to use when querying the ledger. If not provided, the default commitment of the node is used.filter
(string, optional): Filters the results by account type. Accepted values are:circulating
: Returns the largest accounts that are part of the circulating supply.nonCirculating
: Returns the largest accounts that are not part of the circulating supply (e.g., locked accounts, foundation accounts). If omitted, all accounts are considered without this specific filter.
Response Structure
The result
field of the JSON-RPC response will be an RpcResponse
object. The value
field within this object is an array of up to 20 account objects, each containing:
address
(string): The base-58 encoded public key of the account.lamports
(u64): The balance of the account in lamports.
The response also includes a context
object with the slot
at which the information was retrieved.
Examples
1. Get the Top 20 Largest Accounts (No Filter)
This example fetches the top 20 largest accounts by lamport balance without any supply filter.
2. Get the Top 20 Largest Circulating Accounts
This example fetches the top 20 largest accounts that are considered part of the circulating supply.
Developer Tips
- Cached Data: The results can be cached by the RPC node for up to two hours. This means the data might not be real-time to the latest block.
- Limited to Top 20: This method only returns the top 20 accounts. For a more comprehensive analysis of wealth distribution, other data sources or methods might be needed.
- Filter Behavior: The
circulating
andnonCirculating
filters depend on the RPC node’s definition and data sources for these classifications.
This guide provides the necessary information to use the getLargestAccounts
RPC method for querying the largest SOL holders on the Solana network.