How does rent per byte work on solana

Hello guys,

Currently, I’m trying to figure out what is the actual rent per byte on the Solana network. So far i had found only high-level docs on the topic and the following implementation for rent

https://docs.rs/solana-program/1.8.6/src/solana_program/rent.rs.html

From the comments, it seems like the price is 3.65$ per year assuming that the price of solana is 1$ (e.g. 730$ with the price of 200$)

So the first question is, Is that the correct calculation?

The second question is what happens if their is insufficient balance in the account?

The third question, from my understanding about blockchain so far I was left under the impression that no data is being deleted ever, so what happens with the data that has unpaind rent, and can you delete stored data in order to reduce your rent?

Any references to more detailed articles on the topic will be appreciated

I’m not sure if the Solana Mainnet uses that value you linked to for the rent or not, because I believe it can be configured when seeding the network, but there is a good doc on it here:

Also see this one:

You can also use the Solana CLI to connect to the mainnet and get the exact amount of rent required for any amount of bytes.

I’m not on the mainnet right now, but as an example with my local test validator, here’s how you can find out how much rent is required to be rent exempt:

$ solana rent 32 # The 32 is the number of bytes
Rent per byte-year: 0.00000348 SOL
Rent per epoch: 0.000003048 SOL
Rent-exempt minimum: 0.0011136 SOL

As far as I understand, the account is deleted, so all the data in the account then becomes inaccessible on the chain.

In Bitcoin and Ethereum, that is the case, but in Solana, in order to better align the incentives of the validators and the users of the network, if you want data to be stored permanently, you can make your account rent exempt, by depositing 2 years worth of rent in your account. Then the account will never be deleted.

The docs I linked to have a bit more info on that.

In all of the Solana applications I’ve seen so far, whenever you add account data to the chain, you pretty much just make sure you have enough SOL to make the account rent exempt so that you never have to worry about it getting deleted.

I don’t think accounts can be resized. :thinking: I heard somebody somewhere mention something like “having to do manual account resizing” or something like that, but I’m not sure if that literally involved deleting and recreating the account with a different data size or something like that.

Again, though, in practice, you’ll probably just make all your accounts rent-exempt and then never have to think about rent for that account after that.

1 Like