All tokens on Solana that aren't native SOL are referred to as "SPL Tokens" and created using the Token Program (SPL stands for Solana Program Library). Stablecoins like USDC and USDT are also just another SPL Token.
Although tokens have names like "USDC" or "USDT", SPL Tokens are really identified by their "Mint Address". For example,
Circle's USDC docs show the "Mint Address"mint address of "USDC"USDC on Mainnet is EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
https://explorer.solana.com/address/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1vEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
. Circle also has a USDC mint address on testnet.
ForThere is no official USDC mint on devnet. However for testing on devnet, you can create two new SPL Tokens, mint yourself these tokens, and use the "Mint Address" for each token as a placeholder to represent "USDC" and "USDT" in your program.
You can create new SPL Tokens on devnet using either Solana CLI or the @solana/spl-token
library.
If using @solana/spl-token
, you can use:
createMint
- to create new token mints (set yourself as mint authority)
getOrCreateAssociatedTokenAccount
- to get/create a token account to hold tokens for a specific token mint
mintTo
- to mint tokens from the token mint you created to a token account
Alternatively, you get aan unofficial devnet SPL Token already named "USDC-Dev" with the "Mint Address" Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr
here: