Question about token transfer fees

Hi,

I’ve been playing around with Solana CLI and SPL-Token and I found some behavior with transfering a custom Token.

I found that if the recipient already has tokens of that type in the account, the fee is 0.000005 SOL, which is the epected. However, if the recipient didn’t have any tokens of that type in the account (i.e. a recently created account), then the fees are much higher (around 0.002 SOL).

Can anyone help me understand this behavior?

Hi @JGP and welcome to the forum! :wave:

In Solana, every different kind of token you hold in your wallet, other than native SOL, has what’s called an “Associated Token Account” that keeps track of how much of that token you have. Because this associated token account takes up storage on the blockchain, you must pay a fee to make sure that storage is maintained permanently by the network. That is the extra 0.002 SOL.

Every time you get a new kind of token in your wallet, a new Associated Token Account is created, and it is funded with 0.002 SOL. As you noticed, this only needs to happen one time per token.

If you transferred all of a certain token out of your wallet, and you don’t want to have the 0.002 SOL sitting in that Associated Token Account, you can close the account and take back the SOL. The easiest way to close the account is to use the feature in the Solflare wallet that lets you close the account.

The other two ways I know to do it is to use either the Solana CLI or the https://soltricks.io/ website. Just a warning about Soltricks, while it looks pretty legitimate, at the same time it seems a little bit new and not ultra polished or professional. I did successfully close some of my accounts using the tool and it worked, but I would just be cautious when using it.

Let me know if you have any other questions!

Hi, thanks for the information!

Just one more question:

The 0.002 Sol fee ensures the account is rent exempt?

When an account is closed, does the 0.002 sol return back to the payer account or the the main account associated to the token account being closed?

Cheers

Exactly.

I’m pretty sure it returns to the owner of the account, but I haven’t specifically tested this.

Hi, I have a question,

I am very new to all of this, but what commands do i use to transfer SOL back from a token account to the main account that owns it?

thanks