Developer Documentation

Solana Token Burn & Account Closure Code

SolanaBurner uses the SPL Token Program to permanently destroy tokens and reclaim SOL from unused token accounts. This page demonstrates the core instructions used during those operations.

Burning SPL Tokens

Token burning removes assets from a token account and reduces the circulating supply recorded by the token mint.

The SPL Token Program provides a dedicated burn instruction that permanently destroys the specified amount.

createBurnInstruction
tx.add(
  createBurnInstruction(
    ata,
    mint.publicKey,
    publicKey,
    amount
  )
);

Understanding The Parameters

  • ata
    Token account holding the balance being burned.
  • mint.publicKey
    Token mint whose supply will be reduced.
  • publicKey
    Owner of the token account authorizing the burn.
  • amount
    Quantity to burn expressed in the token's smallest units.

Handling Token Decimals

SPL tokens store balances in base units rather than human-readable values.

Before creating the burn instruction, the user-entered amount must be converted using the token's decimal precision.

Example:

  • • 1 token with 6 decimals = 1,000,000 units
  • • 5 tokens with 6 decimals = 5,000,000 units
  • • 100 tokens with 9 decimals = 100,000,000,000 units

Closing Empty Token Accounts

After a token balance reaches zero, the token account still exists on chain.

SolanaBurner allows users to close those empty accounts and recover the SOL rent reserve back into their wallet.

createCloseAccountInstruction
tx.add(
  createCloseAccountInstruction(
    ata,
    publicKey,
    publicKey,
    [],
    t.programId
  )
);

Why Close Token Accounts?

Every token account on Solana requires a small amount of SOL to remain rent exempt.

Closing unused accounts returns that SOL back to the wallet owner and helps reduce wallet clutter.

  • • Recover reserved SOL
  • • Remove empty accounts
  • • Simplify wallet management
  • • Reduce unnecessary account count

How SolanaBurner Uses These Instructions

When a user selects a token and clicks Burn, SolanaBurner constructs a burn instruction using the amount provided by the user.

When a token account contains zero balance, the interface instead presents a Close Token Account & Reclaim SOL action that creates a close account instruction.

Both actions require wallet approval and are executed directly through the SPL Token Program.

Important Reminder

Burn transactions are irreversible. Once confirmed, destroyed tokens cannot be recovered. Always verify the token and amount before approving any transaction.