4

Creating accounts to store data require 2 years worth of rent to be paid upfront, as per the size of the account. This is done to make accounts rent exempt. Also the storage rent per byte gets cheaper with time as hardware costs decrease. Are there any tools available to compute the rent to be paid in sol for creating an account, given the account's size?

2 Answers 2

6

You can use the solana rent shipped with Solana CLI to calculate the rent-exempt for a given account size

For example, calculate rent for a 32 bytes account: solana rent 32

Rent per byte-year: 0.00000348 SOL
Rent per epoch: 0.000003048 SOL
Rent-exempt minimum: 0.0011136 SOL
2

You can also use the getMinimumBalanceForRentExemption method:

import { Connection, clusterApiUrl } from "@solana/web3.js";

const connection = new Connection(clusterApiUrl("mainnet-beta"), "confirmed");

const size = 32; // bytes
const lamports = await connection.getMinimumBalanceForRentExemption(size);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.