spl-token CLI. You will create a mint, create an account that can hold the
token, mint 100 tokens, and transfer some to another wallet.
Run the commands in your browser in
Solana Playground, or run them locally. The
spl-token CLI ships with the
Solana CLI,
so a local Solana CLI install already includes it. To install spl-token on
its own, run cargo install spl-token-cli --locked. The addresses in your
output will differ from the examples below.
In Playground, the terminal opens inside a project: under Start from
scratch, click Start, then press Ctrl+J or click Terminal at the
bottom of the editor. Enter one command at a time: in a multi-line paste,
Playground runs the first line, then joins each later line onto the lines before
it, so those commands fail.
1. Connect to devnet
Point the CLI at devnet:Terminal
Your Playground wallet is not connected. Connect it? [Y/n]. Type y, then
click Continue in the Playground Wallet dialog. The Playground wallet
pays the fees and signs every command on this page, so skip solana-keygen
below: Playground doesn’t have that command.
Locally, create a keypair if you don’t have one. The CLI uses
~/.config/solana/id.json as your wallet: it pays the fees and signs every
command on this page.
Terminal
solana airdrop fails on devnet. Instead, print your
wallet address:
Terminal
solana balance. For other faucets,
see Airdrops and faucets.
Locally, you can skip the faucet by running the quickstart against a local
validator: start solana-test-validator in a second terminal, run
solana config set --url localhost, and fund your wallet with
solana airdrop 2, which still works there.
Use devnet tokens only for testing. They have no financial value.
2. Create a token
Create the mint account that identifies your token:Terminal
Terminal
3. Create a token account
Your wallet needs a token account for this mint before it can hold a balance:Terminal
4. Mint tokens
Mint 100 tokens into your associated token account:Terminal
Terminal
5. Transfer tokens
Send 10 tokens to another devnet wallet. The--fund-recipient option
creates the recipient’s associated token account if it does not exist. If the
recipient wallet holds no SOL, also pass --allow-unfunded-recipient, or the
CLI refuses to send:
Terminal
Optional: add Token-2022 metadata
To store a name, symbol, and URI directly on a new Token-2022 mint, create it with the metadata extension enabled. Run this section with the localspl-token CLI: the version in Solana Playground doesn’t support
--enable-metadata or initialize-metadata.
Terminal
Terminal
Where to go next
- Token basics - perform the same operations in TypeScript or Rust
- Token extensions - add transfer fees, metadata, pausing, and other Token-2022 features
- Asset issuance and tokenization - design and operate production tokenized assets