getMinimumBalanceForRentExemption

function getMinimumBalanceForRentExemption(space): Lamports;

Calculates the minimum lamports required to make an account rent exempt for a given data size, without performing an RPC call.

Values are sourced from the on-chain rent parameters in the Solana runtime: https://github.com/anza-xyz/solana-sdk/blob/c07f692e41d757057c8700211a9300cdcd6d33b1/rent/src/lib.rs#L93-L97

Note that this logic may change, or be incorrect depending on the cluster you are connected to. You can always use the RPC method getMinimumBalanceForRentExemption to get the current value.

Parameters

ParameterTypeDescription
spacebigintThe number of bytes of account data.

Returns

Lamports

Deprecated

The minimum balance for an account is being actively reduced (see SIMD-0437) and is expected to become dynamic in future Solana upgrades (see SIMD-0194 and SIMD-0389), meaning a hardcoded local computation will no longer return accurate results. Use the getMinimumBalanceForRentExemption RPC method or a ClientWithGetMinimumBalance plugin instead. This function will be removed in v7.

On this page