Getting Started
Burn Fungible Tokens
Burn fungible tokens to permanently remove them from circulation on the Solana blockchain.
Burn Tokens
In the following section you can find a full code example and the parameters that you might have to change. Burning tokens permanently destroys them—this action cannot be undone.
1// To install all the required packages use the following command
2// npm install @metaplex-foundation/mpl-toolbox @metaplex-foundation/umi @metaplex-foundation/umi-bundle-defaults
3import {
4 burnToken,
5 findAssociatedTokenPda,
6} from '@metaplex-foundation/mpl-toolbox';
7import {
8 keypairIdentity,
9 publicKey,
10} from '@metaplex-foundation/umi';
11import { createUmi } from '@metaplex-foundation/umi-bundle-defaults';
12import { readFileSync } from 'fs';
13
14// Initialize Umi with Devnet endpoint
15const umi = createUmi('https://api.devnet.solana.com')
16
17// Load your wallet/keypair
18const wallet = '<your wallet file path>'
19const secretKey = JSON.parse(readFileSync(wallet, 'utf-8'))
20const keypair = umi.eddsa.createKeypairFromSecretKey(new Uint8Array(secretKey))
21umi.use(keypairIdentity(keypair))
22
23// Your token mint address
24const mintAddress = publicKey('<your token mint address>')
25
26// Find the token account to burn from
27const tokenAccount = findAssociatedTokenPda(umi, {
28 mint: mintAddress,
29 owner: umi.identity.publicKey,
30})
31
32// Burn 100 tokens
33await burnToken(umi, {
34 account: tokenAccount,
35 mint: mintAddress,
36 amount: 100,
37}).sendAndConfirm(umi)
38
39console.log('Burned 100 tokens')
40console.log('Mint:', mintAddress)
41console.log('Token Account:', tokenAccount)
Parameters
Customize these parameters for your burn operation:
| Parameter | Description |
|---|---|
mintAddress | The token mint address |
amount | Number of tokens to burn |
How It Works
The burn process involves two steps:
- Find your token account - Locate your token account using
findAssociatedTokenPda - Burn tokens - Execute the burn with
burnToken
When to Burn Tokens
Common use cases for burning tokens include:
- Reducing supply - Decrease total circulating supply
- Deflationary mechanics - Implement tokenomics that reduce supply over time
- Error correction - Remove tokens minted by mistake
Important Notes
- Burning is permanent and cannot be reversed
- You can only burn tokens that you own
- The
amountshould account for decimals (e.g., for 9 decimals, burning 1 token requiresamount: 1_000_000_000)
