Minting & Burning
Minting increases SPL token supply by crediting a token account. Burning destroys tokens from a holder's account and reduces supply. Both require correct authority and raw integer amounts.
Recipe
spl-token mint <MINT> <RAW_AMOUNT> <RECIPIENT_TOKEN_ACCOUNT>
spl-token burn <MINT> <RAW_AMOUNT>use anchor_spl::token::{self, MintTo, Burn};
token::mint_to(cpi_ctx, amount)?;
token::burn(cpi_ctx, amount)?;When to reach for this:
- Initial token distribution after launch
- Treasury inflation or reward emissions
- Buyback-and-burn tokenomics
- Reducing supply before revoking mint authority
Working Example
solana config set --url devnet
MINT=$(spl-token create-token --decimals 9 | awk '/Creating token/{print $3}')
spl-token create-account "$MINT"
spl-token mint "$MINT" 5000000000 # 5.0 tokens at 9 decimals
spl-token supply "$MINT"
spl-token burn "$MINT" 1000000000 # burn 1.0 token from your ATA
spl-token supply "$MINT"use anchor_lang::prelude::*;
use anchor_spl::token::{self, Mint, Token, TokenAccount, MintTo, Burn};
#[derive(Accounts)]
pub struct IssueReward<'info> {
#[account(mut)]
pub mint: Account<'info, Mint>,
#[account(mut)]
pub recipient_ata: Account<'info, TokenAccount>,
pub mint_authority: Signer<'info>,
pub token_program: Program<'info, Token>,
}
pub fn issue_reward(ctx: Context<IssueReward>, amount: u64) -> Result<()> {
require!(ctx.accounts.mint.mint_authority.unwrap() == ctx.accounts.mint_authority.key(), ErrorCode::Unauthorized);
let cpi = CpiContext::new(
ctx.accounts.token_program.to_account_info(),
MintTo {
mint: ctx.accounts.mint.to_account_info(),
to: ctx.accounts.recipient_ata.to_account_info(),
authority: ctx.accounts.mint_authority.to_account_info(),
},
);
token::mint_to(cpi, amount)?;
Ok(())
}
#[error_code]
pub enum ErrorCode {
Unauthorized,
}What this demonstrates:
- Mint authority signer must match mint's
mint_authorityfield mint_tocredits any token account for that mintburndebits signer's token account and updates mint supply
Deep Dive
How It Works
- Mint account stores
supply: u64updated on every mint/burn - Amounts are always raw integers; decimals are display-only on mint
- Mint authority
Nonemeans minting is permanently disabled - Burn requires account owner signature (or delegate with sufficient allowance)
Supply Lifecycle
| Step | Supply | Authority |
|---|---|---|
| Create mint | 0 | Mint authority set |
| Mint tokens | Increases | Same |
| Burn tokens | Decreases | N/A |
| Revoke mint auth | Unchanged | Minting disabled |
Rust Notes
// Validate mint matches recipient ATA
require_keys_eq!(recipient_ata.mint, mint.key(), ErrorCode::MintMismatch);
require!(amount > 0, ErrorCode::ZeroAmount);Gotchas
- Decimal math errors - minting
100with 6 decimals is 0.0001 tokens. Fix: multiply UI amount by10^decimals. - Minting after authority revoked - instruction fails. Fix: check
mint_authoritybefore UI flows. - Mint to wrong mint's ATA - CPI fails or credits wrong asset. Fix:
require_keys_eq!ontoken_account.mint. - Burning more than balance - insufficient funds error. Fix: read ATA amount first.
- Overflow on large mints - supply is u64. Fix: cap emissions; use checked math in off-chain planning.
Alternatives
| Alternative | Use When | Don't Use When |
|---|---|---|
| Pre-mint full supply then revoke | Fixed-cap launches | Ongoing inflation tokenomics |
| Transfer from treasury ATA | No inflation; redistribute existing supply | Need net-new supply |
| Token-2022 mint close | Reclaim rent on abandoned mint | Active mint |
FAQs
Who can mint tokens?
The pubkey in the mint's mint_authority field, until set to None.
Can anyone burn my tokens?
Only account owner or an approved delegate with burn permission via standard SPL rules (owner signs burn).
Does burning send tokens anywhere?
No. Tokens are destroyed and mint supply decreases.
Can I mint to multiple accounts in one tx?
Yes. Multiple MintTo instructions in one transaction.
What happens if mint authority is a PDA?
Program signs mint_to with PDA seeds as CPI authority.
Is there a max supply?
u64::MAX raw units - plan decimals accordingly for UI sanity.
Can I burn without holding mint authority?
Yes. Holders burn their own balances; mint authority not required.
How do I verify supply on-chain?
Read mint account supply field or spl-token supply <MINT>.
Does Token-2022 change mint/burn?
Same concepts; additional extensions may gate transfers after mint.
Should I revoke mint authority at launch?
Common for memecoins and fixed-supply assets after initial distribution completes.
Can mint and freeze authority be the same?
Yes, but revoking mint does not automatically remove freeze authority.
How do indexers track mints?
Subscribe to Token program instructions or parse MintTo in transaction logs.
Related
- Authorities - revoke mint authority
- Decimals & Amounts - raw vs UI amounts
- SPL Token in Programs - CPI patterns
Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, anchor-lang 0.32.1, Rust 1.91.1, @solana/kit 7.0.0, Surfpool 0.12.0, and LiteSVM 0.6.x.