1

Does anyone know how to transfer token on solana without paying rent which is equivalent to ~0.002 sol?

2 Answers 2

3

Referring to token account costs:

If the receiving account does not have a corresponding token account, then rent is required to create it. However, if the receiving account is in your control, then you can reclaim the rent after it is no longer needed. Some services and applications (like exchanges) will subsidize this cost for you, but utilizing this depends on your situation.

3

The rent is the cost to allocate the space for the Token account. It requires 165 bytes.

Here is how you can determine how much SOL is is currently needed for rent exemption for 165 bytes using TypeScript. The amount needed may be subject to change in the future.

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

const connection = new Connection("https://api.mainnet-beta.solana.com");
(async () => {
    const minRent = await connection.getMinimumBalanceForRentExemption(165);
    console.log(minRent/10**9);
})();

You do need to have an account for token owner, because the amount and other information needed by the SPL Token program is stored in the Account struct. Preferably this is derived as a PDA using the Associated Token Account program.

Once the token account is no longer needed, when amount is equal to zero, the owner can reclaim the SOL used for rent exemption using the CloseAccount instruction of the SPL Token program.

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.