简体   繁体   中英

Does creating a token account on Solana make it rent free automatically?

I have create a token on the devote and have created token account which I can transfer my token to successfully. I notice that a Solana fee is taken when I do this.

I also understand that I have to deposit enough Solana into an account to pay for rent or have 2 years worth of Solana to make it exempt.

When I create the account (using the code below) is it automatically making the accounts rent exempt or do I have to transfer additional Solana to do so.

How can I do this?

Code:

const tokenAccount = await getOrCreateAssociatedTokenAccount(
  connection,
  payer,
  mint,
  payer.publicKey
)

Yes, an associated token account created by this call will be rent exempt. You can see it in the associated-token-program source code .

All new accounts now require to be rent exempt cf https://docs.solana.com/developing/programming-model/accounts#rent

So any accounts initialised successfully will be rent exempt. You don't have to worry about anything

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM