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
Install Solana CLI
Install SPL Token CLI (must support Token-2022)
Set Up Solana CLI for Devnet
Airdrop Some SOL for Fees
Step-by-Step Token-2022 Minting
1. Create a Token-2022 Mint
Save the returned token mint address.
2. Create a Token Account for Your Wallet
3. Mint Tokens to Your Account
4. Confirm Token Balance
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
Initialize Transfer Fee
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
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!
Last updated