{"id":22164825,"url":"https://github.com/net2devcrypto/solana-spl-program-tutorial","last_synced_at":"2026-03-15T16:34:02.049Z","repository":{"id":243585568,"uuid":"812435893","full_name":"net2devcrypto/Solana-SPL-Program-Tutorial","owner":"net2devcrypto","description":"How to write Solana SPL Token Programs to launch your own token on the Solana blockchain.","archived":false,"fork":false,"pushed_at":"2024-06-21T17:21:30.000Z","size":944,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-22T22:28:41.980Z","etag":null,"topics":["anchor","anchor-lang","blockchain","solana","spl","spl-token","spl-token-2022"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/net2devcrypto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-08T22:15:41.000Z","updated_at":"2024-06-21T17:21:33.000Z","dependencies_parsed_at":"2024-06-10T01:40:02.821Z","dependency_job_id":"25288d3d-4ed5-4503-bb92-32e4d09d2689","html_url":"https://github.com/net2devcrypto/Solana-SPL-Program-Tutorial","commit_stats":null,"previous_names":["net2devcrypto/solana-spl-program-tutorial"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/net2devcrypto%2FSolana-SPL-Program-Tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/net2devcrypto%2FSolana-SPL-Program-Tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/net2devcrypto%2FSolana-SPL-Program-Tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/net2devcrypto%2FSolana-SPL-Program-Tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/net2devcrypto","download_url":"https://codeload.github.com/net2devcrypto/Solana-SPL-Program-Tutorial/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227674004,"owners_count":17802303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anchor","anchor-lang","blockchain","solana","spl","spl-token","spl-token-2022"],"created_at":"2024-12-02T05:10:51.916Z","updated_at":"2026-03-15T16:34:02.001Z","avatar_url":"https://github.com/net2devcrypto.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Solana-SPL-Program-Tutorial\n\nA 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. \n\n\n\u003cimg src=\"https://raw.githubusercontent.com/net2devcrypto/misc/main/anchorlogo.png\" width=\"150\" height=\"45\"\u003e \u003cimg src=\"https://raw.githubusercontent.com/net2devcrypto/misc/main/sol-logo.png\" width=\"190\" height=\"40\"\u003e\n\n\u003e [!NOTE]  \n\u003e THE FILES ATTACHED TO THIS REPO ARE FOR EDUCATIONAL PURPOSES ONLY.\n\u003e NOT FINANCIAL ADVICE\n\u003e USE IT AT YOUR OWN RISK, I'M NOT RESPONSIBLE FOR ANY USE, ISSUES.\n\n\u003ch3\u003eVideo 1\u003c/h3\u003e\n\n\u003ca href=\"https://youtu.be/g2YK_YBWA9A\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/net2devcrypto/misc/blob/main/ytlogo2.png\" width=\"150\" height=\"40\"\u003e\u003c/a\u003e\n\n\u003ch3\u003eVideo 2\u003c/h3\u003e\n\n\u003ca href=\"https://youtu.be/tzaZJXS7AWM\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/net2devcrypto/misc/blob/main/ytlogo2.png\" width=\"150\" height=\"40\"\u003e\u003c/a\u003e\n\n\u003ch3\u003eSetup Anchor Development Environment Instructions\u003c/h3\u003e\n\n\u003ch4\u003eThe steps below are compatible with Ubuntu 22.04\u003c/h4\u003e\n\n\u003e [!NOTE]  \n\u003e If you have Windows, please download VMware Workstation Player, install then create a virtual machine. Follow the tutorial video for full guidance.\n\u003e \n\u003e VMware Workstation Player for Windows: https://www.techspot.com/downloads/downloadnowfile/1969/?evp=4c50cf08866937ea246522b86f4d4286\u0026file=2171\n\u003e\n\u003e Ubuntu Desktop 22.04 ISO: https://releases.ubuntu.com/jammy/ubuntu-22.04.4-desktop-amd64.iso\n\u003e \n\n\u003ch4\u003eStep 1 Dependencies\u003c/h4\u003e\n\n```shell\nsudo apt-get update \u0026\u0026 sudo apt-get upgrade \u0026\u0026 sudo apt-get install -y curl pkg-config build-essential libudev-dev libssl-dev\n```\n\n\u003ch4\u003eStep 2 Install Rust\u003c/h4\u003e\n\n```shell\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n```\nPress Enter When Prompted.\n\n\u003ch4\u003eStep 3 Install Solana CLI\u003c/h4\u003e\n\n```shell\nsh -c \"$(curl -sSfL https://release.solana.com/v1.18.14/install)\"\n```\n\n\u003ch4\u003eStep 4 Update PATH (UBUNTU ONLY)\u003c/h4\u003e\n\n```shell\nnano ~/.bashrc\n```\n\nAdd this line to end of file:\n\n```shell\nexport PATH=\"/root/.local/share/solana/install/active_release/bin:$PATH\"\n```\n\nsave by :  CTRL + X , Press Y, ENTER\n\nReboot PC.\n\nOpen back the terminal then confirm that Solana Cli is active by typing \"solana\" and press ENTER.\n\n\u003ch4\u003eStep 5 Install NodeJS\u003c/h4\u003e\n\n```shell\ncurl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh\n```\n\n```shell\nsudo -E bash nodesource_setup.sh\n```\n\n```shell\nsudo apt-get install -y nodejs\n```\n\nVerify Installation:\n\n```shell\nnode -v\n```\n\n\u003ch4\u003eStep 6 Install Yarn\u003c/h4\u003e\n\n```shell\ncorepack enable\nyarn init -2\n```\n\nIgnore Error: Internal Error: Process git failed to spawn\n\n\u003ch4\u003eStep 7 Install Anchor\u003c/h4\u003e\n\n```shell\ncargo install --git https://github.com/coral-xyz/anchor avm --locked --force\n```\n\n```shell\navm install latest\navm use latest\n```\n\nVerify Installation:\n\n```shell\nanchor --version\n```\n\n\u003ch4\u003eStep 8 Generate Dev Solana Wallet \u003c/h4\u003e\n\n```shell\nsolana-keygen new\n```\n\n\u003ch3\u003eVideo 3\u003c/h3\u003e\n\n\u003ca href=\"https://youtu.be/66o6qma2Jdc\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/net2devcrypto/misc/blob/main/ytlogo2.png\" width=\"150\" height=\"40\"\u003e\u003c/a\u003e\n\n\u003ch3\u003eDeploy SPL Token Program\u003c/h3\u003e\n\n\n## Step 1 Build and Deploy SPL Program\n\n\u003ch5\u003e A - Download Repo Folder SplToken\u003c/h5\u003e\n\n\u003ch5\u003e B - Create a new Anchor project named \"spl\"\u003c/h5\u003e\n\n```shell\nanchor init spl\n```\n\n\u003ch5\u003e C - Open the spl project folder in VS Code\u003c/h5\u003e\n\n\u003ch5\u003e D - Replace the lib.rs file located in the programs/spl/src folder with the lib.rs file located in the downloaded SplToken folder\u003c/h5\u003e\n\n\u003ch5\u003e E - Replace the cargo.toml file located in the project programs/spl folder with the cargo.toml file located in the downloaded SplToken folder\u003c/h5\u003e\n\n\u003ch5\u003e F - Go to the Anchor.toml file located at the root of the project folder and change cluster to devnet.\u003c/h5\u003e\n\n```shell\n[provider]\ncluster = \"devnet\"\n```\n\nSAVE FILE!\n\n\u003ch5\u003e G - Open terminal and proceed to build project then deploy.\u003c/h5\u003e\n\n```shell\nanchor build\n```\n\n```shell\nanchor deploy\n```\n\n\u003ch5\u003e H - Copy the program ID obtained once the deployment has completed.\u003c/h5\u003e\n\n\u003ch5\u003e I - Go to target/types/spl.ts and update the address with the program ID obtained after anchor deploy.\u003c/h5\u003e\n\n```shell\nexport type Spl = {\n  \"address\": \"ENTERPROGRAMID\",\n```\n\nSAVE FILE!\n\n\u003ch5\u003e J - Go to target/idl/spl.json and update the address with the program ID obtained as well\u003c/h5\u003e\n\n```shell\n{\n  \"address\": \"ENTERPROGRAMID\",\n```\n\nSAVE FILE!\n\n\u003ch5\u003e K - Go to programs/src/lib.rs and update declareid with the program ID obtained as well\u003c/h5\u003e\n\n```shell\ndeclare_id!(\"ENTERPROGRAMID\");\n```\n\nSAVE FILE!\n\n\n## Step 2 Create and Store Metadata in Arweave\n\nWatch @ https://youtu.be/66o6qma2Jdc?t=3m40s\n\nCopy the metadata.json Arweave path.\n\n## Step 3 Initiate SPL Token and Mint\n\n\u003ch5\u003e A - Replace on spl project, the file tests/spl.ts with the spl.ts test file located in the downloaded SplToken folder\u003c/h5\u003e\n\n\u003ch5\u003e B - Edit the spl.ts test file by providing the token metadata with your values and amount to initially mint.\u003c/h5\u003e\n\n```shell\nconst metadata = {\n    name: \"Net2Dev Rewards SPL\",\n    symbol: \"N2DR\",\n    uri: \"https://arweave.net/Xjqaj_rYYQGrsiTk9JRqpguA813w6NGPikcRyA1vAHM\", //replace with Arweave metadata json path\n    decimals: 9,\n  };\nconst mintAmount = 10; // Amount of tokens to initially mint.\n```\n\nSAVE FILE!\n\n\u003ch5\u003e C - Open terminal and proceed to run test.\u003c/h5\u003e\n\n```shell\nanchor test\n```\n\n## Step 4 Transfer Tokens to new Wallet from Owner Wallet\n\n\u003ch5\u003e A - Copy the file spl-transfer.js from the downloaded SplToken folder and paste into the spl project folder\u003c/h5\u003e\n\n\u003ch5\u003e B - Open terminal and install solana/spl-token sdk\u003c/h5\u003e\n\n```shell\nnpm i @solana/spl-token\n```\n\n\u003ch5\u003e C - Obtain the private key of the program owner as string, copy the value\u003c/h5\u003e\n\nWatch @ https://youtu.be/66o6qma2Jdc?t=55m30s\n\n\u003ch5\u003e D - Edit the spl-transfer.js with the following values\u003c/h5\u003e\n\n```shell\nconst owner = 'REPLACEWITHSTRINGPRIVATEKEY' // private key string previously obtained \nconst spltoken = new PublicKey(\"SPLPROGRAMID\"); // Program Id of your SPL Token, obtained during \"anchor deploy\"\n\nconst tokens = 2; // set the amount of tokens to transfer.\n```\n\nSAVE FILE!\n\n\n\u003ch5\u003e E - Create new solana wallet (Phantom Wallet for example) and copy address\u003c/h5\u003e\n\n\u003ch5\u003e F - Add the new wallet address obtained previously to the spl-transfer.js as destination wallet \u003c/h5\u003e\n\n\n```shell\nconst destWallet = new PublicKey(\"NEWWALLETADDRESS\");\n```\n\nSAVE FILE!\n\n\n\u003ch5\u003e G - Run the Test and confirm that the ATA got generated and you got tokens on the new destination wallet!\u003c/h5\u003e\n\n\n```shell\nnode spl-transfer.js\n```\n\nExpected Result:\n\n\n```shell\ncreate ata txhash: 4uU9xegH7YZ3tTC934PBSzsVQf3pwoA5BWwXnpFpuK7aCTDu9yqK32r2Vjsbqz4vxhMReeL6NkmQ1hZPg3XSAXh8\nTokens transferred Successfully, Receipt: rttSvKXANuiTZkUmx1gj5B1jSH6bNz4NU64YmvqXouLYoWzqejot1NXxGrML7L87FWa2tX8WBDViKw8C5nmEZrC\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnet2devcrypto%2Fsolana-spl-program-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnet2devcrypto%2Fsolana-spl-program-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnet2devcrypto%2Fsolana-spl-program-tutorial/lists"}