Parameters
length
The Account’s data length
config
Configuration object containing the following fields:
Result
result
Minimum lamports required in the Account to remain rent free
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
RPC methods
CLI reference
Network constants
curl https://api.devnet.solana.com -s -X POST \
-H "Content-Type: application/json" \
-d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getMinimumBalanceForRentExemption",
"params": [
50,
{
"commitment": "processed"
}
]
}
'
import { createSolanaRpc } from "@solana/kit";
const rpc_url = "https://api.devnet.solana.com";
const rpc = createSolanaRpc(rpc_url);
let dataLength = BigInt(50);
let minBalForRentExemption = await rpc
.getMinimumBalanceForRentExemption(dataLength)
.send();
console.log(minBalForRentExemption);
import { Connection, clusterApiUrl } from "@solana/web3.js";
const connection = new Connection(clusterApiUrl("devnet"), "confirmed");
let dataLength = 50;
let minBalForRentExemption =
await connection.getMinimumBalanceForRentExemption(dataLength);
console.log(minBalForRentExemption);
use anyhow::Result;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;
#[tokio::main]
async fn main() -> Result<()> {
let client = RpcClient::new_with_commitment(
String::from("https://api.devnet.solana.com"),
CommitmentConfig::confirmed(),
);
let data_len = 50;
let min_bal_for_rent_exemption = client
.get_minimum_balance_for_rent_exemption(data_len)
.await?;
println!("{:#?}", min_bal_for_rent_exemption);
Ok(())
}
{
"jsonrpc": "2.0",
"result": 1113600,
"id": 1
}
Returns the lamports required to make an account of a given data size rent exempt.
curl https://api.devnet.solana.com -s -X POST \
-H "Content-Type: application/json" \
-d '
{
"jsonrpc": "2.0",
"id": 1,
"method": "getMinimumBalanceForRentExemption",
"params": [
50,
{
"commitment": "processed"
}
]
}
'
import { createSolanaRpc } from "@solana/kit";
const rpc_url = "https://api.devnet.solana.com";
const rpc = createSolanaRpc(rpc_url);
let dataLength = BigInt(50);
let minBalForRentExemption = await rpc
.getMinimumBalanceForRentExemption(dataLength)
.send();
console.log(minBalForRentExemption);
import { Connection, clusterApiUrl } from "@solana/web3.js";
const connection = new Connection(clusterApiUrl("devnet"), "confirmed");
let dataLength = 50;
let minBalForRentExemption =
await connection.getMinimumBalanceForRentExemption(dataLength);
console.log(minBalForRentExemption);
use anyhow::Result;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_commitment_config::CommitmentConfig;
#[tokio::main]
async fn main() -> Result<()> {
let client = RpcClient::new_with_commitment(
String::from("https://api.devnet.solana.com"),
CommitmentConfig::confirmed(),
);
let data_len = 50;
let min_bal_for_rent_exemption = client
.get_minimum_balance_for_rent_exemption(data_len)
.await?;
println!("{:#?}", min_bal_for_rent_exemption);
Ok(())
}
{
"jsonrpc": "2.0",
"result": 1113600,
"id": 1
}
Show propertiesHide properties
processed, confirmed, finalizedSolana RPC uses the following commitment levels:| Value | Description |
|---|---|
processed | Return data from the highest slot this node has processed. This is the newest view, but the block can still be skipped. |
confirmed | Return data from the same slot as finalized. Kept for compatibility and planned for removal in a later release. |
finalized | Return data from the highest slot with a finalization certificate, from votes by 80% of stake in one round or 60% of stake in each of two rounds. This is the strongest commitment level. |