Chainstack GEN 2.0 is live: lower latency for Solana, Ethereum, Base, and every chain on Global Nodes. See what’s new
  • Agents
  • Pricing

How to mint Solana SPL tokens in 2 minutes

Created Aug 16, 2023 Updated Sep 7, 2023
Create Solana Tokens 1024x576 logo

This guide will show you how to mint Solana SPL tokens in just 2 minutes.

To start, make a directory for your project.

mkdir solana token

Now move into that directory

cd solana-token

And now you need to configure your client with an RPC node.

In this case, we are going to use Chainstack in order to launch a Solana Devnet node.

If you do not have a Chainstack account yet, you can sign up for free in order to follow along with this tutorial.

After you have your account, you can go ahead and deploy a node by following the steps in the video below.

Once your node is running, you can click on it to see its details.

Scroll to the bottom of the page and grab the HTTPS endpoint.

Now go ahead and add that HTTPS endpoint into your client configuration.

config set --url https://nd-560-135-593.p2pify.com/2586ee2280f80a8953f2ff1b6f4077b4

Now you should have the RPC URL set, as long as with the web socket URL to go with it.

Now we are going to generate a new Solana account on the Devnet, which we will do with solana-keygen.

We will do this in a new subdirectory of the directory that we’ve just created called “wallet”, and we’ll name this keypair1.json

solana-keygen new --outfile /wallet/keypair1.json

You should see that a new account has been created, along with its public key.

Get funds from the faucet

You need to take the public key and fund it with some Devnet Solana in order to mint your tokens.

You can use this faucet https://solfaucet.com/ in order to request some Devnet tokens.

Just input your address there and click on Devnet.

Now we need to make sure that the account that we’ve just created is the default signer in our client, which we can do with the Solana config command.

solana config set --keypair /wallet/keypair1.json

Now we can go ahead and start creating the SPL token itself. Start by doing:

spl-token create-token

This will call the default token program on devnet through the Chainstack node that we deployed earlier, and this will be about 9 decimals by default.

Now we need to create the token account, which we can do with:

spl-token create-account {input address of the token that was generated here}

Now that this account is generated, we can go ahead and mint our SPL token.

We can do this with:

spl-token mint {input token address here} 1000

Recap of what you did in order to mint Solana SPL tokens:

  1. You’ve set up a project.
  2. Created an account.
  3. Funded that account with devnet tokens.
  4. Created a token.
  5. Minted a token.

You should have the 1000 minted tokens in your token address.

You can open the Solana devnet explorer and search for your address in order to check its balance.

Check the “Tokens” section, and you should have the 1000 tokens in there.

And that’s a wrap. If you are looking for more solana-web3.js tutorials, make sure to check out our blog and developer portal.

Power-boost your project on Chainstack

Have you already explored what you can achieve with Chainstack? Get started for free today.

SHARE THIS ARTICLE
Cropped World Map Top 10.1@3x Featured 2 530x281 logo

The Ethereum cloud vs. on-premises nodes conundrum

Is there a way to actually identify how many Ethereum nodes are running in cloud and on-premises? There is, and it’s easy enough.

In this article, we are going to get the Ethereum mainnet node data and have a look at it.

Evgeny Konstantinov 150x150 logo
Evgeny Konstantinov
Sep 24
Customer Stories

Saakuru Labs

Saakuru Labs seamlessly transitions businesses from Web2 to Web3 with a 4X infrastructure ROI using Chainstack Global Node.

Defined

Defined deliver real-time blockchain data for over 2M tokens and 800M NFTs with reliable Web3 infrastructure.

FailSafe

FailSafe revolutionizes Web3 security to reduce latency, boost transaction volumes, and user safety with Chainstack RPCs.