How to Use getTokenLargestAccounts
Learn getTokenLargestAccounts use cases, code examples, request parameters, response structure, and tips.
The getTokenLargestAccounts
RPC method returns a list of the 20 largest token accounts for a given SPL Token mint. This is useful for analyzing token distribution and identifying major holders of a particular token.
Common Use Cases
- Token Distribution Analysis: Understanding how a token’s supply is distributed among its holders.
- Identifying Whales: Finding accounts that hold significant amounts of a specific token.
- Market Research: Gauging the concentration of token ownership.
- Displaying Top Holders: Showing a list of the largest accounts in a token explorer or dashboard.
Request Parameters
-
mintAddress
(string, required): The base-58 encoded public key of the token mint for which you want to find the largest accounts. -
options
(object, optional): An optional configuration object that can include:commitment
(string, optional): Specifies the commitment level for the query (e.g.,"finalized"
,"confirmed"
,"processed"
).
Response Structure
The result.value
field in the JSON-RPC response is an array of up to 20 objects. Each object represents one of the largest token accounts and contains the following fields:
address
(string): The base-58 encoded public key of the token account.amount
(string): The raw balance of the token account, as a string. This value is not adjusted for decimals.decimals
(u8): The number of decimal places defined for this token mint.uiAmount
(number | null): The token balance as a floating-point number, adjusted for decimals. This field might be deprecated or less reliable;uiAmountString
is preferred.uiAmountString
(string): The token balance as a string, adjusted for decimals. This is the most user-friendly representation of the balance.
Example Response:
Code Examples
Developer Tips
- Fixed Limit: This method always returns up to the top 20 largest accounts. It does not support pagination or requesting more than 20 accounts.
- Data Accuracy: The data reflects the state of the ledger at the slot determined by the specified commitment level.
- Token Mint Specific: The results are specific to the single token mint provided in the request.
- Performance: This is a targeted query and generally performs well. However, excessive polling should be avoided.
This guide helps you use the getTokenLargestAccounts
RPC method to discover the primary holders of any SPL token on Solana.