From Scratch: How to Create Your Own Token on Solana with Solana CLI and TypeScript

·

Introduction

Creating your own cryptocurrency token on the Solana blockchain is an exciting way to dive into Web3 development. This guide will walk you through the entire process—from setting up your development environment to minting and transferring tokens—using Solana CLI and TypeScript.

Key Takeaways:


Prerequisites

Before we begin, ensure you have:

👉 Get started with Solana development today


How Token Creation Works on Solana

1. Solana Network Overview

The Solana network consists of decentralized nodes that validate transactions. Unlike Ethereum, Solana uses a unique Proof-of-History (PoH) consensus mechanism combined with Proof-of-Stake (PoS) for high throughput.

2. Core Components


Step-by-Step Token Creation

Step 1: Set Up Solana CLI

Install Solana CLI tools following the official documentation. Verify installation with:

solana --version

Step 2: Create Wallets

  1. User Wallet: Install Backpack or Phantom extension
  2. Bank Wallet: Generate via CLI:

    solana-keygen new

    Save the displayed recovery phrase securely.

Step 3: Configure Devnet

Use Solana's devnet for testing:

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

Fund your wallet with Devnet SOL:

solana airdrop 1

Step 4: Create Your Token

Execute this command to create a token:

spl-token create-token

This generates:

Step 5: Mint Initial Supply

  1. Create a token account:

    spl-token create-account <MINT_ADDRESS>
  2. Mint tokens:

    spl-token mint <MINT_ADDRESS> 10000

Advanced Token Management

Adding Metadata (TypeScript)

Upload token metadata to Arweave using Metaplex:

const metaplex = Metaplex.make(connection)
  .use(keypairIdentity(wallet))
  .use(bundlrStorage());
const { uri } = await metaplex.nfts().uploadMetadata({
  name: "MyToken",
  symbol: "MTK",
  description: "My custom Solana token",
  image: "ipfs://my-image-cid"
});

Programmatic Transfers

Transfer tokens between wallets:

const transferInstruction = createTransferInstruction(
  sourceAccount,
  destAccount,
  wallet.publicKey,
  amount * (10 ** decimals)
);

Limiting Token Supply

Disable future minting:

spl-token authorize <MINT_ADDRESS> mint --disable

FAQ Section

Q: How much does it cost to create a Solana token?

A: On Devnet: $0. On Mainnet: ~0.01 SOL for creation + gas fees.

Q: Can I update token metadata after creation?

A: Yes, until you disable the mint authority.

Q: What's the difference between SPL and native SOL?

A: SPL tokens are customizable assets, while SOL is Solana's native cryptocurrency.

👉 Explore more Solana development resources


Conclusion

You've now learned how to:

  1. Set up a Solana development environment
  2. Create and mint custom tokens
  3. Add rich metadata
  4. Transfer tokens programmatically
  5. Manage token supply

For reference code, visit this GitHub repository.

Next Steps

Happy coding! 🚀