Did you know that it is possible to mint a coin on Solana in five simple steps? If this sounds exciting and you want to get into Solana token development, follow along in this step-by-step guide covering the entire process. In combination with demonstrating how to mint a coin on Solana, the guide will briefly explore the intricacies of Solana and the SPL token standard. Accordingly, if you want to learn the fundamentals of Solana token development, you are in the right place!
In short, you must complete the following five steps to mint a coin on Solana:
- Create a Solana Wallet
- Solana Cluster Configuration
- Acquire Testnet SOL
- Mint a Coin on Solana
After reading this guide, you will get familiar with minting Solana tokens and the ins and outs of Solana token development. In turn, you might want to leverage your skills and build more sophisticated Solana-compatible Web3 projects. If so, you should know that Moralis offers the most accessible way to build Solana-compatible dapps. One of Moralis’ prominent Web3 APIs is the Solana API, allowing you to create dapps and other Web3 projects in no time!
Also, with Moralis, you can expand beyond the Solana network. Moralis’ cross-chain capabilities make it possible to develop dapps for other networks as well. In fact, Moralis presents the fastest way to build a Web3 app for multiple different networks. If this interests you, we recommend checking out Moralis’ Polygon boilerplate or the Cronos boilerplate.
Furthermore, no matter if you are looking to create Solana projects or dapps for other networks, make sure to sign up with Moralis. With Moralis, you have the opportunity to leverage the power of Web3 with the seamless developer experience of Web2!
Solana and the SPL Standard – Mint a Coin on Solana
Before showing you how to mint a coin on Solana, we will take this initial section to dive deeper into the intricacies of Solana and the SPL token standard, starting with the former!
Solana is a programmable, open-source blockchain that emphasizes speed and scalability. This focus allows the network to facilitate and process transactions rapidly and at lower costs than some of its competitors. One of Solana’s unique selling points is the network’s implementation of a hybrid consensus mechanism. Solana combines the more conventional PoS (proof-of-stake) consensus with something known as PoH (proof-of-history).
PoH is essentially a way for the network to put timestamps on transactions. Consequently, Solana does not need to wait for transactions to be put into blocks but can process transactions in a parallel fashion and add them to blocks later. Thanks to this, it means that Solana, theoretically, can process hundreds of thousands of transactions each second.
Moreover, the native currency of the Solana blockchain is called SOL, which is a so-called SPL token. Furthermore, SPL is essentially what ERC-20, ERC-271, and ERC-1155 are to the Ethereum blockchain. As such, SPL can be seen as the token standard for the Solana chain.
However, if you are familiar with Ethereum token development, you know that ERC-20 regulates fungible tokens, and ERC-721 handles NFTs. In the Solana network, only one program defines the common implementation of NFTs and fungible tokens. As such, Solana has one standard that regulates both these token types, called SPL.
Now that we have covered Solana and the SPL standard, it is time to dive into the following sections and illustrate how to mint a coin on Solana!
How to Mint a Coin on Solana – 5-Step Breakdown
With a more profound understanding of Solana and the SPL standard, it is now time to delve deeper into the central part of this “How to Mint a Coin on Solana” tutorial. Moreover, to make the process more understandable and straightforward, the article breaks it down into the following five steps:
- Prerequisites – Install Rust, the Solana CLI, and the SPL CLI.
- Create a Solana Wallet – Set up a Solana file system wallet.
- Solana Cluster Configuration – Make configurations to make sure you’re on the correct network or cluster.
- Acquire Testnet SOL – Obtain test SOL to use during your development process.
- Mint a Coin on Solana – Create a coin with the SPL CLI, set the supply, and mint the coin.
Following the steps above will allow you to mint a coin on Solana in no time! Now, if you want to create NFTs instead, the process does not differ all that much. As such, you will be able to use the same fundamental principles to create Solana NFTs alike. Moreover, if Solana token development interests you even further, check out our guide from Moralis on how to create your own Solana NFT. This article covers the intricacies of Solana token development even further by illustrating how to build an NFT minting tool!
Nonetheless, let us proceed and jump straight into the tutorial by covering the prerequisites needed to mint a coin on Solana!
Step 1: Prerequisites
Since Rust is the primary programming language of Solana token development, the first part of this five-step tutorial on how to mint a coin on Solana revolves around the installation of Rust. So, if you have not already, let us proceed by installing some Rust tooling!
If you are using a macOS or Linux device, you can install Rust by running the following command in the terminal:
curl https://sh.rustup.rs -sSf | sh
On the other hand, if you are on a Windows device, you can download and run the following: “rustup-init.exe“. Running this starts the installation in a console. Nevertheless, no matter what alternative you go for, once the installation process completes, it will display the following message:
The second prerequisite is to install the Solana CLI (command line interface). Here are the two alternatives for you to run in your terminal, depending on if you are using macOS/Linux or a Windows device:
- For macOS/Linux:
sh -c "$(curl -sSfL https://release.solana.com/v1.9.5/install)"
- For Windows:
curl https://release.solana.com/v1.9.5/solana-install-init-x86_64-pc-windows-msvc.exe --output C:\solana-install-tmp\solana-install-init.exe --create-dirs
With the Solana CLI at your disposal, the next part of this initial step is installing the SPL CLI. Since you previously installed Rust, you can run the following “cargo” command to do so:
cargo install spl-token-cli
The “cargo” command is essentially “npm” or “yarn” for Rust. Nonetheless, this covers the prerequisites for this tutorial on how to mint a coin on Solana. The following step will illustrate how to set up a Solana wallet!
Step 2: Create a Solana Wallet
With the prerequisites finalized, this section will illustrate how to set up a Solana file system wallet. A file system wallet works for testing purposes; however, it is not recommended for the actual production of Web3 projects.
Nevertheless, to create the file system Solana wallet, input and run the following command in the terminal:
solana-keygen new --no-outfile
As soon as you run the command above, it should autonomously set up the Solana wallet in no time. To make sure that everything works, you can input the command below to check the balance of your wallet:
However, as you just created the wallet from scratch, it should display a balance of ”0 SOL”. However, in the fourth step, we will briefly show you how to add some testnet SOL to this file system Solana wallet.
Step 3: Solana Cluster Configuration
Before adding testnet SOL to your Solana wallet, you must ensure you are on the right network or cluster. If not, you will need to make configurations to the Solana cluster. To check the current cluster configurations, you can run the following command:
solana config get
Running the command above should provide a response similar to the one below:
As the image illustrates, we are currently connected to the testnet. However, you can change the cluster to another network, such as the devnet, by running the following in your terminal:
solana config set --url https://api.devnet.solana.com
If you decide to change the cluster configurations, you can make sure that everything works as intended by running the command from before again:
solana config get
That covers the third step needed to mint a coin on Solana. Now, let us proceed to the next step in this tutorial and explore how to acquire testnet SOL!
Step 4: Acquire Testnet Sol
If you followed along in the second step of this tutorial, you just recently created your Solana wallet. If this is the case, the wallet’s balance will be zero, which we’re now about to change. This step of the tutorial demonstrates how to acquire some testnet SOL for you to use during your development endeavors.
Acquiring testnet SOL is relatively straightforward, and all you need to do is run the following command in the terminal:
solana airdrop 1
Once you run the command, it should add one testnet SOL to your Solana wallet. To make sure that everything was executed and works correctly, you can go ahead and run the command below to check the balance:
As you airdropped SOL into the wallet, it should now say ”1 SOL” instead of ”0 SOL”. That covers the fourth step required to mint a coin on Solana! In the following section, the article explores the most central part of the tutorial – how to actually mint a coin on Solana!
Step 5: Mint a Coin on Solana
Now that you have finalized all prerequisites, acquired a Solana wallet with testnet SOL, and made the proper cluster configurations, it is time to illustrate how to mint a coin on Solana. So, to create the Solana token with the SPL CLI, go ahead and run the following command:
Running the command above will create the token and supply a token identifier:
Initially, when you create the Solana token, the supply should equal zero. You can check this by running the following command with the token identifier:
spl-token supply <token-identifier>
Since the initial supply is zero, you’ll need to mint a supply. To do so, you must first create an account for the token. Most Solana programs do not have storage capabilities by default. Consequently, to be able to store any data, you will need to create a token account. Creating an account is easy; all you need to do is run the following command in the terminal with the token identifier:
spl-token create-account <token-identifier>
Now that the token has an account, it is possible to mint a coin on Solana. All you need is to input the following command into the terminal using the token identifier and specify the token amount:
spl-token mint <token-identifier> <token-amount>
Running the command above will mint the specified number of Solana tokens into your wallet. Moreover, to make sure that everything works as intended, check the token balance of that specific token in your wallet by inputting the following command into the terminal:
spl-token balance <token-identifier>
Now that is it! You are now able to mint a coin on Solana. Moreover, this was a fungible token, and if you want to create non-fungible tokens, the process does not differ all that much! If NFT development excites you, check out Moralis’ NFT API allowing you to create sophisticated NFT-related projects in no time!
Summary – How to Mint a Coin on Solana
This article delved deep into the intricacies of Solana, the SPL token standard, and Solana token development. More specifically, the central part of the guide illustrates how to mint a coin on Solana in only five steps:
- Create a Solana Wallet
- Solana Cluster Configuration
- Acquire Testnet Sol
- Mint a Coin on Solana
Following the steps above allows anyone to mint a coin on Solana. Moreover, although this article focuses on fungible token development, the same principles can be applied when creating NFTs. Nevertheless, if you followed along in the tutorial, you will now hopefully have the needed skills to mint a coin on Solana!
If you found this tutorial helpful, check out additional exciting guides here on Moralis’ Web3 blog. For example, if you have a particular interest in Solana, we recommend checking out our guides on Solana smart contract building or how to build a Solana NFT explorer.
However, Moralis is not limited to Solana, and you can utilize the tools of Moralis in several aspects of Web3 development. For instance, if you want to boost your Web3 development capabilities, you should check out the recently launched Moralis Web3 Streams API. This tool allows you to stream blockchain data into the backend of all your projects via webhooks. Furthermore, the API supports several networks, such as Ethereum, Polygon, BNB Chain, Fantom, Avalanche, etc.
It does not matter what kind of Web3 developer you are; sign up with Moralis now and supercharge your Web3 development capabilities! With Moralis, you can fully unlock the power of blockchain by building faster and smarter through utilizing Moralis’ APIs, bridging the gap between We2 and Web3!