3

Accounts on Solana are considered rent-exempt if they hold at least the cost of their rent for 2 years (based on the size of the account's data).

Is it possible to create an account that's not rent-exempt?

In the program code, I'm calculating rent using the following experiment:

let lamports_required_one_year = (Rent::get()?).due_amount(account_span, 1.0);
let lamports_required_for_exemption = (Rent::get()?).minimum_balance(account_span);

Then I'm hitting the System Program with a CPI using system_instruction::create_account().

I can create an account successfully with lamports_required_for_exemption as the lamports deposited, but if I use lamports_required_one_year I get the following:

Transaction simulation failed: Transaction leaves an account with a lower balance than rent-exempt minimum

You can also throw the same error from the CLI if you try to airdrop less than the rent-exempt amount to a brand new keypair.

So I'm wondering - if this method blocks creation of an account with less than the 2-year exemption requirement, how do you create an account with less than 2 years' of rent?

I'm also curious - since the rent exemption is fairly inexpensive - what is the use case for non-rent-exempt account creation?

1 Answer 1

4

As of the require accounts to be rent-exempt feature activation, no accounts can be created with less rent than the 2 year rent exemption requirement.

All accounts created previous to the feature activation are unaffected.

See the note in the documentation.

4
  • after it's been created, is it possible to decrease the amount so that it's no longer exempt?
    – coco
    Jul 25, 2022 at 22:08
  • No, it is not possible to decrease below rent exemption
    – Jacob Creech
    Jul 25, 2022 at 22:10
  • does this mean it's no longer possible to delete accounts? I was under the impression that I just had to transfer all lamports out of the account to "close" it
    – coco
    Jul 25, 2022 at 22:39
  • @coco please make this another question. Would be great help for those looking for that answer
    – Jacob Creech
    Jul 26, 2022 at 13:46

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.