👑
Solana Development Bible
  • Install the Solana Tool Suite CLI
  • Solana CLI Usage Refrence
  • What Are SPL Tokens?
  • Creating an SPL Token on Solana
  • Creating a Token-2022 on Solana
  • Find NFT Candy Machine ID
  • How to pull a hashlist and clean up data.
  • Solana CLI Usage Reference 2025
Powered by GitBook
On this page
  • Prerequisites
  • Step-by-Step Token-2022 Minting
  • Adding Token Extensions
  • Resources
  • Notes

Creating a Token-2022 on Solana

Quickly mint a Token-2022 compliant SPL token on Solana Devnet or Mainnet using the command-line interface (CLI).

This guide explains how to quickly mint a Token-2022 compliant SPL token on Solana Devnet using the command-line interface (CLI). It also shows how to enable and use token extensions such as metadata and transfer fees.


Prerequisites

  1. Install Solana CLI

    sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
  2. Install SPL Token CLI (must support Token-2022)

    cargo install spl-token-cli
  3. Set Up Solana CLI for Devnet

    solana config set --url https://api.devnet.solana.com
    solana config set --keypair /path/to/your/dev-wallet.json
  4. Airdrop Some SOL for Fees

    solana airdrop 2

Step-by-Step Token-2022 Minting

1. Create a Token-2022 Mint

spl-token create-token \
  --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb

Save the returned token mint address.

2. Create a Token Account for Your Wallet

spl-token create-account <TOKEN_MINT_ADDRESS> \
  --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb

3. Mint Tokens to Your Account

spl-token mint <TOKEN_MINT_ADDRESS> 1000 \
  --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb

4. Confirm Token Balance

spl-token accounts --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb

Adding Token Extensions

Token-2022 supports advanced features called extensions. Below are examples of two useful ones.

Extension 1: Transfer Fee

This allows collecting fees on every token transfer.

Create Mint with Transfer Fee Extension

spl-token create-token \
  --program-id TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb \
  --enable-extensions transferFeeConfig

Initialize Transfer Fee

spl-token enable-transfer-fee \
  <TOKEN_MINT_ADDRESS> \
  --transfer-fee-config-authority <YOUR_WALLET_ADDRESS> \
  --transfer-fee-basis-points 25 \
  --maximum-transfer-fee 10

This sets a 0.25% fee (25 basis points) with a max of 10 tokens per transfer.


Extension 2: Metadata

This enables rich token metadata like name, symbol, and image.

Initialize Metadata

spl-token initialize-metadata <TOKEN_MINT_ADDRESS> \
  "My Test Token" "MTT" "https://example.com/token-metadata.json"

Make sure the JSON metadata file at that URL is hosted and follows the standard format.


Resources


Notes

  • You must use the --program-id Tokenz... flag for all Token-2022 interactions.

  • Some extensions require initializing during the token mint creation.

  • Not all wallets or exchanges currently support Token-2022 tokens.


Happy minting!

PreviousCreating an SPL Token on SolanaNextFind NFT Candy Machine ID

Last updated 5 days ago

Token-2022 Documentation:

Solana Devnet Explorer:

https://spl.solana.com/token-2022
https://explorer.solana.com?cluster=devnet