Create your own token on Solana in less than 5 minutes!

Create your own token on Solana in less than 5 minutes! - thirdweb Guides


In this guide, we are going to use the fresh thirdweb Solana SDK to deploy a token!

Before we get started, below are some helpful resources where you can learn more about the tools we will use in this guide.

Let's get started!


Using the CLI, create a new Node.js & Javascript project with the Solana SDK preconfigured for you, using the following command:

npx thirdweb create app --node --solana

Getting wallet private key

To deploy the contract from our wallet, we need the private key of our wallet. So, go to your phantom wallet (if you haven't already created one, check out this guide) and click on the top right badge and select your wallet. Then click on the export private key button:

Export your private key

Copy this private key, and paste it into a new file .env in the following format:


Using private keys as an env variable is vulnerable to attacks and is not the best practice. We are doing it in this guide for the sake of brevity, but we strongly recommend using a secret manager to store your private key.

Writing the script

Now that we have got everything set up it is time to write our script! Create a new file called deploy-token.mjs in a scripts folder

Initializing the SDK

We need to initialize the thirdweb SDK with the private key that we just exported into our .env file so add the following code:

import { ThirdwebSDK } from "@thirdweb-dev/sdk/solana";
import { config } from "dotenv";

// Instantiate the SDK and pass in a signer
const sdk = ThirdwebSDK.fromPrivateKey("devnet", process.env.PRIVATE_KEY);

Creating the token

For creating the token, we will use the SDK that we initialized and some metadata, so add the following:

// Define the metadata for your program
const metadata = {
  symbol: "TOK",
  description: "My token",
  name: "My Token",
  initialSupply: 100,

// And deploy a new program from the connected wallet
const address = await sdk.deployer.createToken(metadata);

console.log("Contract deployed successfully! 🎉");

You need to change the details in the metadata object to your values.

Getting the token supply

We will also show the total token supply once the contract gets deployed so add this block as well:

const token = await sdk.getToken(address);
const supply = await token.totalSupply();


Running the script

Now, it's the moment of truth! We will run the script and see if our token get's deployed:

node scripts/deploy-token.mjs

Wait for a second for the script to run 🥁 🥁 anddd it works!

Run the script to deploy your token

We now have our own token deployed on Solana! How cool is that? You can even see it in your phantom wallet

You can now see the tokens in your wallet


In this guide, we learned how to use the Solana SDK with node.js and deploy a token. If you made your own token pat yourself on the back and share it with us on the thirdweb discord! If you want to take a look at the code, check out the GitHub Repository!