getBalance
Returns the native SOL balance of an account in lamports (1 SOL = 1,000,000,000 lamports). This is one of the most commonly used RPC methods for checking wallet balances, verifying account funding, and monitoring SOL holdings in real-time. It is lightweight and returns a single numeric value, making it ideal for frequent polling scenarios.
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 |
minContextSlot | number | Minimum slot at which the request can be evaluated |
Response
Returns an RpcResponse object:
| Field | Type | Description |
|---|---|---|
context.slot | u64 | The slot at which the value was read |
value | u64 | The balance in lamports |
Code Examples
cURL
curl http://88.216.36.108:7999 -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getBalance",
"params": [
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
{ "commitment": "confirmed" }
]
}'TypeScript
const response = await fetch("http://88.216.36.108:7999", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
jsonrpc: "2.0",
id: 1,
method: "getBalance",
params: [
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
{ commitment: "confirmed" }
]
}),
});
const { result } = await response.json();
console.log("Balance:", result.value / 1e9, "SOL");Python
import requests
response = requests.post("http://88.216.36.108:7999", json={
"jsonrpc": "2.0",
"id": 1,
"method": "getBalance",
"params": [
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
{"commitment": "confirmed"}
]
})
result = response.json()["result"]
print(f"Balance: {result['value'] / 1e9} SOL")Rust
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let res = client.post("http://88.216.36.108:7999")
.json(&json!({
"jsonrpc": "2.0",
"id": 1,
"method": "getBalance",
"params": [
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
{"commitment": "confirmed"}
]
}))
.send().await?
.text().await?;
println!("{}", res);
Ok(())
}Example Response
{
"jsonrpc": "2.0",
"result": {
"context": { "slot": 123456789 },
"value": 2500000000
},
"id": 1
}