2

Phantom wallet has a burn NFT feature and there are some 3rd party sites that allow burning NFTs, but how do I burn a fungible (non-NFT) token? For example I get airdropped 1000 of some random token, how can I burn them? I don't see the option in phantom.

I understand there is a command-line tool after installing the Solana Tool Suite:

spl-token burn <SOURCE_TOKEN_ACCOUNT_ADDRESS> <TOKEN_AMOUNT> --config <PATH>

How would I link my private key to this command? Also are there any user friendly ways to burn them either via a wallet feature or trusted 3rd party website?

3 Answers 3

6

AFAIK, as of today no wallets provide support to burn fungible tokens.

To burn spammy fungible tokens you can use spl-token command. spl-token command needs the wallet's private keys.

Run solana config get to get your config details.

If Keypair path is set, it'll show up the path to the keypair.json, i,e /Users/userName/folder/keypair.json Otherwise need to set the wallets private keypair by solana config set --keypair keypair_location

spl-token burn tokenAccountAddess 50 

Other approach using NodeJS and @solana package

const {Connection, Keypair, PublicKey} = require('@solana/web3.js');
const { burn, getOrCreateAssociatedTokenAccount } = require('@solana/spl-token');
const fs = require('fs');

const RPC_URL = 'https://solana-api.projectserum.com'; 
const KEYPAIR_PATH = "/Users/pathtokeypair/keypair.json";
const secret = JSON.parse(fs.readFileSync(KEYPAIR_PATH));
const fromWallet = Keypair.fromSecretKey(Uint8Array.from(secret));

const payer = fromWallet;

const tokenMint = 'DfP3GKcq86B6VzGQrG3iupRWwqWcWnLndvFC2FTYKxiT'; // a spammy token 

async function burn() {
    const tokenMintPublicKey = new PublicKey(tokenMint);

    const connection = new Connection(
        RPC_URL,
        {commitment:'confirmed', disableRetryOnRateLimit:false, confirmTransactionInitialTimeout:120000},
      );

    const tokenAccount = await getOrCreateAssociatedTokenAccount(
        connection,
        payer,
        tokenMintPublicKey,
        fromWallet.publicKey
    );
  
    const signature = await burn(
        connection,
        payer,
        tokenAccount.address,
        tokenMintPublicKey,
        fromWallet.publicKey,
        amountOfTokens * 9 // tokenDecimals of the tokenMint
        []
    );
    console.log('signature', signature);
    return signature;
}

burn();

Note:- Take caution to not delete valid tokens.

1

Actually, Solflare wallet has an option to burn & close an account in its web app version.

Click on the token you want to burn in the wallet list, then you'll get token details. On the lower right corner, above the send button, you got a setting button. If you click on it, you'll get 3 options, with the one at the bottom being "burn & close".

0

Looks like Sol-Incinerator was recently updated and now has an option to burn fungible tokens as well as NFTs.

enter image description here

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.