TriportRPC

getMinimumBalanceForRentExemption

POSThttps://api.triport.io

Returns the minimum balance, in lamports, required to make a Solana account of a given data size rent-exempt.

Solanafree+ — 20 / 60 / 200 / 600 RPS (free / basic / pro / business), sol_read_rpc category

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

JSON-RPC params is a positional array: [dataLength, config?].

dataLengthintegerrequired
Size of the account's data field, in bytes.
configobjectoptional
Commitment configuration (see below).
commitmentstringoptional
Commitment level: processed, confirmed, or finalized.
minContextSlotintegeroptional
Minimum slot at which the request should be evaluated.

Response

Response fields

FieldTypeDescription
resultintegerMinimum lamports needed to make an account of dataLength bytes rent-exempt.

Errors

Errors use the standard JSON-RPC envelope. See errors.md for the full envelope and the complete code table.

CodeMeaningWhen it happens
-32602Invalid paramsdataLength missing, negative, or not an integer.
-32003Rate limit exceededMore than your tier's sol_read_rpc RPS (20 / 60 / 200 / 600); honor Retry-After.
-32601Method not foundThe method name is misspelled or not recognised on this chain.

Examples

JavaScript (fetch)

const res = await fetch("https://api.triport.io", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getMinimumBalanceForRentExemption",
    params: [50],
  }),
});


const { result } = await res.json();
console.log(`Rent-exempt minimum: ${result} lamports`);

TypeScript SDK (@triport/sdk)

import { TriportClient } from "@triport/sdk";


const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY! });


const lamports: number = await client.solana.getMinimumBalanceForRentExemption(50, {
  commitment: "confirmed",
});


console.log(lamports); // 1238880

Python (triport-sdk)

import os
from triport import TriportClient


client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])


lamports = client.solana.get_minimum_balance_for_rent_exemption(50, commitment="confirmed")
print(lamports)  # 1238880

Notes

  • The value scales with dataLength: a 0-byte account costs ~890,880 lamports, and the cost grows linearly with each additional byte. Always pass the exact byte size of the account you intend to allocate.
  • The result is deterministic for a given data size, so cache it per dataLength rather than calling on every transaction build.
  • Related: pair this with getBalance to check whether an existing account already meets the rent-exempt threshold, and with getAccountInfo to read an account's current data size.