SolDevHub

Mint Tokens

Learn how to mint additional supply for a token you control.

Overview

Minting tokens allows you to increase the total supply of a token. This is only possible if your wallet has mint authority.

Code

const ata = await getAssociatedTokenAddress(
  mint.publicKey,
  publicKey
);

const amount = BigInt(Number(inputAmount) * 10 ** decimals);

const ixMintTo = createMintToInstruction(
  mint.publicKey,   // token mint
  ata,              // destination token account
  publicKey,        // mint authority
  amount,           // amount to mint
);

1. Get Associated Token Account

The associated token account (ATA) is where the minted tokens will be sent. Each wallet has a unique ATA for each token.

2. Calculate Amount

Token amounts must be adjusted using decimals. For example, 1 token with 6 decimals = 1,000,000 units.

3. Create Mint Instruction

The createMintToInstruction function mints tokens from the mint into your token account.

4. Authority Requirement

You must hold mint authority. If it has been revoked, minting will fail.

If mint authority is revoked, you cannot mint more tokens. This cannot be undone.