net2devcrypto
Solana-SPL-Program-Tutorial
Rust

How to write Solana SPL Token Programs to launch your own token on the Solana blockchain.

Last updated Apr 13, 2026
16
Stars
7
Forks
1
Issues
0
Stars/day
Attention Score
9
Language breakdown
Rust 39.6%
TypeScript 34.7%
JavaScript 25.7%
Files click to expand
README

Solana-SPL-Program-Tutorial

A highly requested tutorial! We are covering from start to finish how to write Solana SPL Token Program to launch your own token on the Solana blockchain.

[!NOTE]
THE FILES ATTACHED TO THIS REPO ARE FOR EDUCATIONAL PURPOSES ONLY.
NOT FINANCIAL ADVICE
USE IT AT YOUR OWN RISK, I'M NOT RESPONSIBLE FOR ANY USE, ISSUES.

Video 1

Video 2

Setup Anchor Development Environment Instructions

The steps below are compatible with Ubuntu 22.04

[!NOTE]
If you have Windows, please download VMware Workstation Player, install then create a virtual machine. Follow the tutorial video for full guidance.
>
VMware Workstation Player for Windows: https://www.techspot.com/downloads/downloadnowfile/1969/?evp=4c50cf08866937ea246522b86f4d4286&file=2171
>
Ubuntu Desktop 22.04 ISO: https://releases.ubuntu.com/jammy/ubuntu-22.04.4-desktop-amd64.iso
>

Step 1 Dependencies

sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y curl pkg-config build-essential libudev-dev libssl-dev

Step 2 Install Rust

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Press Enter When Prompted.

Step 3 Install Solana CLI

sh -c "$(curl -sSfL https://release.solana.com/v1.18.14/install)"

Step 4 Update PATH (UBUNTU ONLY)

nano ~/.bashrc

Add this line to end of file:

export PATH="/root/.local/share/solana/install/active_release/bin:$PATH"

save by : CTRL + X , Press Y, ENTER

Reboot PC.

Open back the terminal then confirm that Solana Cli is active by typing "solana" and press ENTER.

Step 5 Install NodeJS

curl -fsSL https://deb.nodesource.com/setup20.x -o nodesourcesetup.sh
sudo -E bash nodesource_setup.sh
sudo apt-get install -y nodejs

Verify Installation:

node -v

Step 6 Install Yarn

corepack enable
yarn init -2

Ignore Error: Internal Error: Process git failed to spawn

Step 7 Install Anchor

cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
avm install latest
avm use latest

Verify Installation:

anchor --version

Step 8 Generate Dev Solana Wallet

solana-keygen new

Video 3

Deploy SPL Token Program

Step 1 Build and Deploy SPL Program

A - Download Repo Folder SplToken
B - Create a new Anchor project named "spl"
anchor init spl
C - Open the spl project folder in VS Code
D - Replace the lib.rs file located in the programs/spl/src folder with the lib.rs file located in the downloaded SplToken folder
E - Replace the cargo.toml file located in the project programs/spl folder with the cargo.toml file located in the downloaded SplToken folder
F - Go to the Anchor.toml file located at the root of the project folder and change cluster to devnet.
[provider]
cluster = "devnet"

SAVE FILE!

G - Open terminal and proceed to build project then deploy.
anchor build
anchor deploy
H - Copy the program ID obtained once the deployment has completed.
I - Go to target/types/spl.ts and update the address with the program ID obtained after anchor deploy.
export type Spl = {
  "address": "ENTERPROGRAMID",

SAVE FILE!

J - Go to target/idl/spl.json and update the address with the program ID obtained as well
{
  "address": "ENTERPROGRAMID",

SAVE FILE!

K - Go to programs/src/lib.rs and update declareid with the program ID obtained as well
declare_id!("ENTERPROGRAMID");

SAVE FILE!

Step 2 Create and Store Metadata in Arweave

Watch @ https://youtu.be/66o6qma2Jdc?t=3m40s

Copy the metadata.json Arweave path.

Step 3 Initiate SPL Token and Mint

A - Replace on spl project, the file tests/spl.ts with the spl.ts test file located in the downloaded SplToken folder
B - Edit the spl.ts test file by providing the token metadata with your values and amount to initially mint.
const metadata = {
    name: "Net2Dev Rewards SPL",
    symbol: "N2DR",
    uri: "https://arweave.net/Xjqaj_rYYQGrsiTk9JRqpguA813w6NGPikcRyA1vAHM", //replace with Arweave metadata json path
    decimals: 9,
  };
const mintAmount = 10; // Amount of tokens to initially mint.

SAVE FILE!

C - Open terminal and proceed to run test.
anchor test

Step 4 Transfer Tokens to new Wallet from Owner Wallet

A - Copy the file spl-transfer.js from the downloaded SplToken folder and paste into the spl project folder
B - Open terminal and install solana/spl-token sdk
npm i @solana/spl-token
C - Obtain the private key of the program owner as string, copy the value

Watch @ https://youtu.be/66o6qma2Jdc?t=55m30s

D - Edit the spl-transfer.js with the following values
const owner = 'REPLACEWITHSTRINGPRIVATEKEY' // private key string previously obtained 
const spltoken = new PublicKey("SPLPROGRAMID"); // Program Id of your SPL Token, obtained during "anchor deploy"

const tokens = 2; // set the amount of tokens to transfer.

SAVE FILE!

E - Create new solana wallet (Phantom Wallet for example) and copy address
F - Add the new wallet address obtained previously to the spl-transfer.js as destination wallet
const destWallet = new PublicKey("NEWWALLETADDRESS");

SAVE FILE!

G - Run the Test and confirm that the ATA got generated and you got tokens on the new destination wallet!
node spl-transfer.js

Expected Result:

create ata txhash: 4uU9xegH7YZ3tTC934PBSzsVQf3pwoA5BWwXnpFpuK7aCTDu9yqK32r2Vjsbqz4vxhMReeL6NkmQ1hZPg3XSAXh8
Tokens transferred Successfully, Receipt: rttSvKXANuiTZkUmx1gj5B1jSH6bNz4NU64YmvqXouLYoWzqejot1NXxGrML7L87FWa2tX8WBDViKw8C5nmEZrC

© 2026 GitRepoTrend · net2devcrypto/Solana-SPL-Program-Tutorial · Updated daily from GitHub