DEV Community

Cover image for How to Create Your First Token on Solana Devnet (SPL Token CLI Walkthrough)
Samuel Akoji
Samuel Akoji

Posted on

How to Create Your First Token on Solana Devnet (SPL Token CLI Walkthrough)

Welcome to Epoch 2

If you've been following 100 Days of Solana, you've spent the first 28 days learning how Solana stores and reads data wallets, accounts, transactions, and explorers. Epoch 2 shifts gears from reading to creating. And it starts with the most fundamental creative act on Solana: making a token.

This is a complete walkthrough of Day 29's challenge: create a token on devnet using the SPL Token CLI, mint 100 units, and understand what you actually built.

Prerequisites

Make sure you have the Solana CLI installed and configured for devnet:

solana config set --url devnet
solana airdrop 2
Enter fullscreen mode Exit fullscreen mode

Then install the SPL Token CLI:

cargo install spl-token-cli
Enter fullscreen mode Exit fullscreen mode

Verify it's working:

spl-token --version
Enter fullscreen mode Exit fullscreen mode

Step 1: Create a Token Mint

A token mint is the on-chain account that defines your token its total supply, how many decimal places it has, and who has authority to create more. Think of it as the "factory" for your token, not the token balance itself.

spl-token create-token
Enter fullscreen mode Exit fullscreen mode

Output:
Creating token 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
Address: 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
Decimals: 9
Signature: 5wTgYNMBRULKGSfRQkFsgSbxwFAq3QQtHbdxiR3LYLU5t3sGRD4ETFZHDvFBRTHxgfEjS5c1s6GfmFE8bqjyJwH

Save that token address you'll need it for every subsequent step. The address is the mint account's public key on-chain. Anyone who knows this address can look it up in Explorer and see everything about your token: total supply, decimals, mint authority.

What just happened: The SPL Token CLI sent a transaction that created a new account on devnet, owned by the Token Program (TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA). That account is your mint. It currently has 0 supply and you are the mint authority.

Step 2: Create a Token Account

Here's where Solana's design becomes visible: your wallet doesn't hold tokens directly. You need a separate token account an account owned by the Token Program that holds your balance of a specific token.

spl-token create-account 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
Enter fullscreen mode Exit fullscreen mode

Output:

Creating account 8uFLaHUJnqFhDxdKWV3TvMSRbsF3Y6gUpUMfzM9JqwbA
Signature: 4QhmnBkNKoK8JXpSv9NXhLJzuRSN9fGPgZ3JpKvwWMTe...

This new address (8uFLaHUJ...) is your token account the account that will hold your balance of your new token. It's a separate account from your wallet, owned by the Token Program, and linked to both your mint and your wallet address.

Cost note: Creating a token account requires a rent-exempt deposit of approximately 0.00203928 SOL. This SOL is returned to you if you ever close the account. This is why receiving a new token sometimes costs a small amount the token account deposit.

Step 3: Mint Some Supply

Now you can actually create tokens. Since you're the mint authority, you control how many tokens come into existence:

spl-token mint 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU 100
Enter fullscreen mode Exit fullscreen mode

Output:
Minting 100 tokens
Token: 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
Recipient: 8uFLaHUJnqFhDxdKWV3TvMSRbsF3Y6gUpUMfzM9JqwbA
Signature: 2XkR7...

100 tokens now exist. They live in your token account. The mint's total supply is now 100.

Step 4: Inspect What You Built

Check your balance:

spl-token balance 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
Enter fullscreen mode Exit fullscreen mode

Output: 100

Check the mint's supply:

spl-token supply 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
Enter fullscreen mode Exit fullscreen mode

Output: 100

List all your token accounts:

spl-token accounts
Enter fullscreen mode Exit fullscreen mode

You'll see a table showing your token mint address, your token account address, and your balance.

Step 5: Verify in Explorer

Paste your mint address into explorer.solana.com (switch to devnet). You'll see:

  • Token Supply: 100
  • Decimals: 9
  • Mint Authority: your wallet address
  • Freeze Authority: None (you didn't set one)

Now paste your token account address. You'll see:

  • Mint: your token mint address
  • Owner: your wallet address
  • Token Balance: 100

Two separate accounts, both visible on-chain, both part of the same token system.

What You Actually Built

In Web2 terms, you just built a custom credits system:

  • The mint = your database schema + business rules ("this currency has 9 decimal places, only I can create more")
  • The token account = a row in your ledger ("this user holds 100 credits")
  • The Token Program = the application server that enforces all the rules

The difference from Web2: you didn't build any of the application server. The Token Program already exists on Solana and handles all the logic. You just created the data accounts and invoked its instructions.

This is the core insight of Epoch 2: Solana's shared programs let you launch digital assets without writing any program code yourself. The infrastructure already exists. You're using it.

What's Next in Epoch 2

Now that you have a token, Epoch 2 will cover:

  • Adding metadata (name, symbol, image) so your token appears properly in wallets
  • Transfer rules and fees
  • Freeze authorities
  • Eventually: NFTs, which are just tokens with supply of 1 and 0 decimals

The foundation you built today mint + token account + SPL Token Program is the same foundation that every token on Solana is built on, from small devnet experiments to billion-dollar DeFi protocols.

Top comments (0)