Create Solana tokens

Chad, Solana
Back

I had to do this and got a bit confused in the process, so I took notes here, incase I need to do this again. This page is inspired by this Figment tutorial.

If you are unsure of what a command does just add --help after it without any inputs. Also use --verbose when runing the commands to get more information.

  1. Create a wallet with public and private keys and then send 0.01 Sol to this wallet
   input -> solana-keygen new --force
   output -> Generating a new keypair
   pubkey: dC3CTsSDtfp9yoDbBoAMExn6yHeTpLEp7Fk12n7oVhw
  1. Create new token
   input -> spl-token create-token
   output -> Creating token HD4wGTJA2HdzDVFqUqwtkvZKE1JJ9NeL8HZxr7Y7uVvG
  1. Create account for this token with: spl-token create-account <TOKEN_ADDRESS>
   input -> spl-token create-account HD4wGTJA2HdzDVFqUqwtkvZKE1JJ9NeL8HZxr7Y7uVvG
   output -> Creating account 1q7aA2kztrAAj7mNKHfrMtagw6qSNrEmhYfZNjLjPzQ
  1. Mint tokens with: spl-token authorize [FLAGS] [OPTIONS] <TOKEN_ADDRESS> <AUTHORITY_TYPE> <AUTHORITY_ADDRESS>
   input -> spl-token mint HD4wGTJA2HdzDVFqUqwtkvZKE1JJ9NeL8HZxr7Y7uVvG 1000000 1q7aA2kztrAAj7mNKHfrMtagw6qSNrEmhYfZNjLjPzQ
   output -> Minting 1000000 tokens
   Token: HD4wGTJA2HdzDVFqUqwtkvZKE1JJ9NeL8HZxr7Y7uVvG
   Recipient: 1q7aA2kztrAAj7mNKHfrMtagw6qSNrEmhYfZNjLjPzQ
  1. Check balance
   input -> spl-token accounts
   output -> Token Balance

HD4wGTJA2HdzDVFqUqwtkvZKE1JJ9NeL8HZxr7Y7uVvG 1000000
  1. Mint more tokens by repeting step 4

  2. Repeat step 5 to confirm that more tokens are minted

  3. Limit supply to prevent unlimited minting with: spl-token authorize <TOKEN_ADDRESS> mint --disable

   input -> spl-token authorize HD4wGTJA2HdzDVFqUqwtkvZKE1JJ9NeL8HZxr7Y7uVvG mint --disable
   output -> Updating HD4wGTJA2HdzDVFqUqwtkvZKE1JJ9NeL8HZxr7Y7uVvG
 Current mint authority: dC3CTsSDtfp9yoDbBoAMExn6yHeTpLEp7Fk12n7oVhw
 New mint authority: disabled
  1. Repeat step 4 and confirm that you cannot mint anymore of these tokens

Note

To work on dev net, use:

solana config set --url https://api.devnet.solana.com

To work on main net, use:

solana config set --url https://api.mainnet-beta.solana.com

Thats all. If someone else reads this and has some feedback, contact me.

© Chad.RSS