Skip to content

Creating a token

Course: Programs, Accounts and the Token Program - chapter 6

Creating your own token (100x coin lets say) requires understanding the Token Program that is written by the engineers at Solana - https://github.com/solana-labs/solana-program-library

Specifically, the way to create a token requires you to

  1. Create a token mint
  2. Create an associated token account for this mint and for a specific user
  3. Mint tokens to that user.

It’s like a bank that has the athority to create more coins. It can also have the authority to freeze coins.

Before you can ask other people to send you a token, you need to create an associated token account for that token and your public key

Reference - https://spl.solana.com/token

Create a new cli wallet
solana-keygen new
Set the RPC url
solana config set --url https://api.devnet.solana.com
Airdrop yourself some SOL
solana airdrop 1
Check your balance
solana balance
Create token mint
spl-token create-token

Verify token mint on chain

Check the supply of the token
spl-token supply AQoKYV7tYpTrFZN6P5oUufbQKAUr9mNYGe1TTJC9wajM
Create an associated token account
spl-token create-account ChNkv9iW5pZJ1YAsNswC2CrdMUkFJBUbRWinjdLvKpXA

Mint some tokens to yourself
spl-token mint ChNkv9iW5pZJ1YAsNswC2CrdMUkFJBUbRWinjdLvKpXA 100
Check your balances in the explorer

Import the token in Phantom and see the balances