TriportRPC

getMinimumBalanceForRentExemption

Last updated:

`getMinimumBalanceForRentExemption` tells you how many lamports an account must hold to be exempt from rent collection, given the account's data size in bytes. On Solana, an account whose balance is at or above this threshold is never charged rent and is never reaped, so you should fund every new account you create with at least this amount.

Use it before sending a transaction that creates or allocates an account (`SystemProgram.createAccount`, a token account, a program-derived account, etc.) so you can size the funding lamports exactly. The returned value depends only on `dataLength` — the same input always yields the same result on a given cluster — so it is safe to cache per data size.

The result is a single integer (lamports), not an object. There is no `context` wrapper around it.

Parameters

getMinimumBalanceForRentExemption parameters
NameTypeRequiredDescription
dataLengthintegerYes
configCommitmentConfigNo

Returns

getMinimumBalanceForRentExemption return value
FieldType
resultinteger

Examples

curl https://<your-endpoint>/ \
  -X POST -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"getMinimumBalanceForRentExemption","params":["<dataLength>","<config>"]}'
const res = await fetch("https://<your-endpoint>/", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "id": 1,
  "method": "getMinimumBalanceForRentExemption",
  "params": [
    "<dataLength>",
    "<config>"
  ],
  "jsonrpc": "2.0"
}),
});
const data = await res.json();
import requests
resp = requests.post("https://<your-endpoint>/", json={"id":1,"method":"getMinimumBalanceForRentExemption","params":["<dataLength>","<config>"],"jsonrpc":"2.0"})
print(resp.json())

Usage

  1. Transport: HTTP (JSON-RPC).
  2. Networks: mainnet, devnet, testnet.
  3. Credit cost: 1 per call.

FAQ

What does getMinimumBalanceForRentExemption do?
Returns the minimum balance, in lamports, required to make a Solana account of a given data size rent-exempt.
How many credits does getMinimumBalanceForRentExemption cost?
getMinimumBalanceForRentExemption costs 1 credit(s) per call on Triport by default.
Is getMinimumBalanceForRentExemption available over WebSocket?
getMinimumBalanceForRentExemption is an HTTP JSON-RPC method.