Tokens

Getting Started

Mint Fungible Tokens

Mint additional fungible tokens to increase the circulating supply of your token on Solana.

Mint Tokens

In the following section you can find a full code example and the parameters that you might have to change. This assumes you already have a fungible token created and want to mint more tokens.

// To install all the required packages use the following command
// npm install @metaplex-foundation/mpl-toolbox @metaplex-foundation/umi @metaplex-foundation/umi-bundle-defaults
import {
createTokenIfMissing,
findAssociatedTokenPda,
mintTokensTo,
} from '@metaplex-foundation/mpl-toolbox';
import {
keypairIdentity,
publicKey,
transactionBuilder,
} from '@metaplex-foundation/umi';
import { createUmi } from '@metaplex-foundation/umi-bundle-defaults';
import { readFileSync } from 'fs';
// Initialize Umi with Devnet endpoint
const umi = createUmi('https://api.devnet.solana.com')
// Load your wallet/keypair
const wallet = '<your wallet file path>'
const secretKey = JSON.parse(readFileSync(wallet, 'utf-8'))
const keypair = umi.eddsa.createKeypairFromSecretKey(new Uint8Array(secretKey))
umi.use(keypairIdentity(keypair))
// Your token mint address and destination wallet
const mintAddress = publicKey('<your token mint address>')
const destinationAddress = publicKey('<destination wallet address>')
// Find the destination token account
const destinationTokenAccount = findAssociatedTokenPda(umi, {
mint: mintAddress,
owner: destinationAddress,
})
// Create the destination token account if it doesn't exist and mint tokens
await transactionBuilder()
.add(createTokenIfMissing(umi, {
mint: mintAddress,
owner: destinationAddress,
}))
// Mint 100 tokens to the destination
.add(
mintTokensTo(umi, {
mint: mintAddress,
token: destinationTokenAccount,
amount: 100,
}))
.sendAndConfirm(umi)
console.log('Minted 100 tokens')
console.log('Mint:', mintAddress)
console.log('To:', destinationTokenAccount)

Parameters

Customize these parameters for your mint operation:

ParameterDescription
mintAddressThe token mint address
destinationAddressWallet address to receive the tokens
amountNumber of tokens to mint

How It Works

The minting process involves three steps:

  1. Find destination token account - Locate the recipient's token account using findAssociatedTokenPda
  2. Create token account if needed - Use createTokenIfMissing to ensure the recipient has a token account
  3. Mint tokens - Execute the mint with mintTokensTo

Requirements

To mint additional tokens, you must:

  • Be the mint authority - Only the wallet designated as the mint authority can mint new tokens
  • Have a mutable token - The token must not have had its mint authority revoked

Common Use Cases

  • Token distributions - Distribute tokens to users or investors
  • Rewards programs - Mint tokens as rewards for users
  • Liquidity provision - Create tokens for liquidity pools
  • Airdrops - Mint tokens to multiple wallets

Important Notes

  • The amount should account for decimals (e.g., for 9 decimals, minting 1 token requires amount: 1_000_000_000)
  • You can mint to any wallet address—the token account will be created if it doesn't exist
  • Only the mint authority can mint new tokens