Overview of Project
Tokens are the building blocks of a digital economy. It is crucial to understand what they are and how to work with them to fully appreciate the power of blockchains. In this post, we show you how.
In this tutorial, we will guide you through the process of minting custom Solana tokens using the Solana Command-Line Interface (CLI). You will learn the three main steps to mint a custom token on Solana: creating the token, creating the token account, and minting a supply for the token. By the end of this tutorial, you will have the knowledge and skills to create your own Solana tokens and start experimenting with the Solana blockchain.
In addition to the CLI experience, we will also provide you with three alternative methods for minting custom Solana tokens quickly and easily. This will give you a variety of options to choose from, depending on your preferences and requirements.
*For more on custom minting through a JavaScript or TS setup, please refer to the Solana docs here: https://spl.solana.com/token
Prerequisites
First we need a few programs installed on our workstation to begin minting the tokens. You can open your terminal app on your workstation to run these commands. If you already have these, you can skip this step.
- Install Rust:
Block Field
- Install Solana CLI:
Block Field
After this is installed you can verify that you have Solana CLI installed by running the following:
Block Field
Which should return a similar result to below:
Block Field
Once this is set up we are ready to continue!
Setting up the Environment
First, we want to set up our environment with 3 things.
- Default network we are using (Mainnet or Devnet).
- Default wallet we are using to mint the tokens.
- Devnet Solana to fund this test.
1. Network
In this step we can use the standard Solana RPCs. You can get a free one from FluxRPC’ developer portal here.
The 2 available are:
- Mainnet -
https://rpc.fluxrpc.xyz/?api-key=<api_key> - Devnet -
https://rpc-devnet.fluxrpc.xyz/?api-key=<api_key>
Once we have our RPC, we can set it to our environment by using the following command:
Block Field
This will set our default network to Devnet on the CLI for our test. You should see the following in your console:
Block Field
Once you see this confirmation, we can move onto the next step.
2. Wallet
In this step we can set up our default wallet used for the test. We can do this by creating a new wallet for the test and setting it as our default for the Solana CLI.
To create a new wallet run the following:
Block Field
Which will create a new wallet-name.json file outside of your home directory.
You will now see the following in your console:
Block Field
Now we can set this wallet as our default address by running the following:
Block Field
You can now run the following to make sure the public key is set correctly.
Block Field
Which in our case provides:
Block Field
Now that we have our default wallet set, we can move on to requesting funds for our test.
3. Funds for Test
Here we will be airdropping the devnet Solana required for the mint through the Solana CLI.
We can run the following command in our terminal to get the required amount:
Block Field
Now we can check the balance of our wallet by running the following:
Block Field
This should return 2 SOL in the console.
If this was unsuccessful, attempt a few more times, as the request could have just failed initially. If still not working, please try re-attempting again.
Once you have SOL in your Devnet wallet, we can continue to creating our tokens.
Steps for Minting from CLI
Now that we have our environment set up, we can actually start minting some tokens! Once these are set, this is a fairly quick set up.
Here are the steps we need to accomplish this:
- Create the token.
- Create the token account.
- Mint the token.
Below is a visual of the set up:
Block Field
Let’s break this down a bit:
- The Token Program is used to create, transfer, and mint additional tokens.
- The user is interacting with the Token Program to create a token. This token program is also used to mint additional supply and transfer tokens.
- Once the token is created, an account to store them can be created as well.
Now dive into the first step, which is creating the token.
1. Create Token
Run the following command to create the token:
Block Field
Which in our case provides the following:
Block Field
2. Create Token Account
Now we can create the account to hold our token supply in.
We can set up the account for our Ax3nE7fAEuZsbN9HHEpuBpoYeYy7NZ3dgjRG8GXdFqto token by running the following command in our terminal, with our token address being passed in:
Block Field
This is creating an account to house the Ax3nE7fAEuZsbN9HHEpuBpoYeYy7NZ3dgjRG8GXdFqto**** token and should produce the following result:
Block Field
We now have a token account to start minting!
3. Minting Tokens
Now, we are set to mint and set a supply for our token. Since we are doing this on Devnet, why don’t we show the true power of Solana by minting 1 million tokens.
We can do this by running the following command, with our token address following the spl-token mint command:
Block Field
This will produce the following in our terminal:
Block Field
We can now run the following command to verify that these were minted:
Block Field
Which will return:
Block Field
Now, we have minted 1 million tokens on Solana using Solana CLI.
Results
To recap, we just minted 1 Million tokens through the Solana CLI spl-token tool. This was accomplished in 3 commands on the Solana CLI.
- Creating the token.
- Creating the token account.
- Minting the token.
If you care to check the balance of your Solana wallet after minting 1,000,000 tokens, run:
Block Field
Which will return this if you started with the initial 2 SOL drop:
Block Field
And that’s it!
Solana makes it possible to scale the token supply and have it at a fractional cost.
If you followed these steps you can now effectively make a token using the Solana CLI spl-token tool.
Available Tools for Minting Tokens
As promised, here are a few tools that you can use RIGHT NOW to create a token with metadata attached at a fraction of the cost. In each example, I will use Monopoly Money to create the token, and show the subsequent drop options available.
1. Famous Fox Federation
This tool has been around for about 6 months and costs .03 SOL to use. Which is very low cost when you compare to the cost of a few million tokens on another blockchain.
Block Field
Here is a breakdown of FFF:
- Make sure you have the SPL token checked here.
- Setting a decimal with a value of 0 will create a WL token standard.
- You can disable future minting of supply here, otherwise, it will be kept open.
- You can then use a tool such as Foxy Share to distribute your tokens at a low cost, in this example, I made a test token and will use the token section to send to :
Block Field
2. Squads
Squads is another easily available front end that comes at a fractional cost, here are the steps to create a token once you are signed into a squad account:
- Go to the Developers tab —> then navigate to Token Manager.
Block Field
2. Once there you can select Add Token then select Create Token and enter the token details (supply will be added later).
Block Field
3. Now we can enter the Token decimals, in this test we are using 9:
Block Field
4. After approving and executing the transaction in Squads, you will now see a set up similar to this:
5. After selecting Mint, enter the amount you would like the create for this supply. As demonstrated below:
Block Field
6. Now you should see another transaction to approve in Squads. After being approved, you will see the token supply we set, as shown below:
Block Field
Now you have created a token with a supply of 1 million using Squads!
You can then set up a custom transaction in the “TX Builder” section to transfer tokens, but I will not touch on that here, as that can be a bit extensive to explain in detail.
This option cost about - 0.00561672 SOL to mint, the same as our Solana CLI option.
3. Strata Protocol
Here is another alternative to minting tokens on Solana.
- You can start by selecting the “Create New Token” option and hitting Next:
Block Field
2. Select “Self Managed” for the manage option:
Block Field
3. Now you can Connect your Solana wallet to fund the transaction, and enter the token details below:
Block Field
Block Field
This transaction only costs .00458 SOL to complete for 1 million tokens, which is still at a fractional value of Solana, and up to par with the competitors. This will attempt a swap for SHDW Storage token if you do not have any existing.
Strata Extras:
Strata has a few other tools available on that main page that are really cool to use as well, such as:
- Token Manager - You can increase supply/ update mint and freeze authority of each token.
- Sell Existing Token - You can set a price or discovery for the token you want to sell.
- Fundraise - Collect funds for a cause, and use the token to represent their contributions.
Conclusion
Now you have a few options to mint a token on Solana that are both scalable in cost, and number of tokens needed. You can truly scale these examples and the cost would not be too different in getting these assets on-chain and ready to distribute.
All examples provided point to the true power of using Solana, and can be used by creators not as technologically savvy as they think they need to be.
An everyday user can mint tokens on Solana through a simple CLI that takes 3 steps, or different competitors at a similar low cost that have additional features to make interacting easier.
If you have any questions or are running into any issues feel free to jump into the FluxRPC Discord!