getAccountInfo
Returns all information associated with the account of the provided public key, including lamports balance, owner program, data content, and executable status. This is the most fundamental read operation on Solana, used by wallets, explorers, and dApps to inspect any on-chain account. It supports multiple encoding formats including jsonParsed for human-readable output of known program accounts such as SPL Token and System accounts.
Parameters
| # | Type | Required | Description |
|---|---|---|---|
| 1 | string | Yes | Base-58 encoded public key of the account to query |
| 2 | object | No | Configuration object |
Configuration object fields:
| Field | Type | Description |
|---|---|---|
commitment | string | Commitment level: processed, confirmed, or finalized |
encoding | string | Data encoding: base58, base64, base64+zstd, or jsonParsed |
dataSlice | object | Request a slice of the account data: { offset: number, length: number }. Only available for base58, base64, or base64+zstd encodings |
minContextSlot | number | Minimum slot at which the request can be evaluated |
Response
Returns an RpcResponse object with value set to null if the account does not exist, otherwise:
| Field | Type | Description |
|---|---|---|
context.slot | u64 | The slot at which the value was read |
value.lamports | u64 | Number of lamports in the account |
value.owner | string | Base-58 encoded program that owns the account |
value.data | [string, string] | object |
value.executable | bool | Whether the account contains a program |
value.rentEpoch | u64 | The epoch at which this account will next owe rent |
value.space | u64 | The data size of the account |
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": "getAccountInfo",
5 "params": [
6 "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
7 { "encoding": "base64", "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: "getAccountInfo",
8 params: [
9 "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
10 { encoding: "base64", commitment: "confirmed" }
11 ]
12 }),
13});
14const { result } = await response.json();
15console.log("Lamports:", result.value.lamports);Python
1import requests
2
3response = requests.post("http://[IP_ADDRESS]:[PORT]", json={
4 "jsonrpc": "2.0",
5 "id": 1,
6 "method": "getAccountInfo",
7 "params": [
8 "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
9 {"encoding": "base64", "commitment": "confirmed"}
10 ]
11})
12result = response.json()["result"]
13print(f"Lamports: {result['value']['lamports']}")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": "getAccountInfo",
12 "params": [
13 "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
14 {"encoding": "base64", "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": 123456789 },
5 "value": {
6 "data": ["", "base64"],
7 "executable": false,
8 "lamports": 1000000000,
9 "owner": "11111111111111111111111111111111",
10 "rentEpoch": 361,
11 "space": 0
12 }
13 },
14 "id": 1
15}