getTokenLargestAccounts
Returns the 20 largest accounts for a specific SPL Token mint, showing who holds the most of a given token. This is invaluable for token analytics, checking token distribution and concentration, identifying major holders (whales), and conducting due diligence on token projects. The results include both raw amounts and human-readable values with decimal formatting.
Parameters
| # | Type | Required | Description |
|---|---|---|---|
| 1 | string | Yes | Base-58 encoded public key of the token mint |
| 2 | object | No | Configuration object |
Configuration object fields:
| Field | Type | Description |
|---|---|---|
commitment | string | Commitment level: processed, confirmed, or finalized |
Response
Returns an RpcResponse with an array of token account objects:
| Field | Type | Description |
|---|---|---|
context.slot | u64 | The slot at which the value was read |
value[].address | string | Token account address (base-58) |
value[].amount | string | Raw token amount as a string |
value[].decimals | u8 | Number of decimals for the token |
value[].uiAmount | `f64 | null` |
value[].uiAmountString | string | Token amount as a string with decimal formatting |
Code Examples
cURL
1curl http://[IP_ADDRESS]:[PORT] -X POST -H "Content-Type: application/json" -d '{
2 "jsonrpc": "2.0",
3 "id": 1,
4 "method": "getTokenLargestAccounts",
5 "params": [
6 "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
7 { "commitment": "confirmed" }
8 ]
9}'TypeScript
1const response = await fetch("http://[IP_ADDRESS]:[PORT]", {
2 method: "POST",
3 headers: { "Content-Type": "application/json" },
4 body: JSON.stringify({
5 jsonrpc: "2.0",
6 id: 1,
7 method: "getTokenLargestAccounts",
8 params: [
9 "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
10 { commitment: "confirmed" }
11 ]
12 }),
13});
14const { result } = await response.json();
15result.value.forEach(a => console.log(a.address, a.uiAmountString));Python
1import requests
2
3response = requests.post("http://[IP_ADDRESS]:[PORT]", json={
4 "jsonrpc": "2.0",
5 "id": 1,
6 "method": "getTokenLargestAccounts",
7 "params": [
8 "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
9 {"commitment": "confirmed"}
10 ]
11})
12result = response.json()["result"]
13for a in result['value']: print(f"{a['address']}: {a['uiAmountString']}")Rust
1use reqwest::Client;
2use serde_json::json;
3
4#[tokio::main]
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6 let client = Client::new();
7 let res = client.post("http://[IP_ADDRESS]:[PORT]")
8 .json(&json!({
9 "jsonrpc": "2.0",
10 "id": 1,
11 "method": "getTokenLargestAccounts",
12 "params": [
13 "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
14 {"commitment": "confirmed"}
15 ]
16 }))
17 .send().await?
18 .text().await?;
19 println!("{}", res);
20 Ok(())
21}Example Response
1{
2 "jsonrpc": "2.0",
3 "result": {
4 "context": { "slot": 166974442 },
5 "value": [
6 {
7 "address": "7kMFogLKhMscgaFQ3AFPoXt9iRnSCCfC4ZCSX4Aq4XWu",
8 "amount": "5000000000000",
9 "decimals": 6,
10 "uiAmount": 5000000.0,
11 "uiAmountString": "5000000"
12 }
13 ]
14 },
15 "id": 1
16}