Here is a step-by-step article on how to create an SPL token using Visual Studio Code (VSCode) with the Solana CLI:
Generate SPL Access Key Using Visual Code
As you mentioned, Solana is a popular blockchain platform that requires advanced programming skills to create complex tokens. However, you can quickly create a simple SPL access key using VSCode and the Solana CLI.
In this article, we will show you how to create a master SPL token for Solana using JavaScript, specifically Solidity.
Required prerequisites
Before you begin, make sure you have:
- Visual Studio Code (VSCode) installed on your WSL (Windows Subsystem for Linux)
- Solana CLI installed and set up
- Solana wallet with sufficient funds
Step 1: Create new directory and install dependencies
Create a new directory for your project:
mkdir solana token
cd solana token
Install the required dependencies:
npm init -y
npm install solana cli @solana/web3.js
The “@solana/web3.js” package contains the Solana CLI and web3.js libraries that we will use to interact with the Solana blockchain.
Step 2: Create a new Solidity contract
Create a new file called “contract.solidity”:
touch contract.strength
Open this file in VSCode and add the following code:
pragma robustness ^0,8,0;
import "
contract SPLtoken {
//Define the token name, symbol and total supply
string public name = "My SPL access key";
public string symbol = "SPLT";
uint public total supply;
// Constructor function to initialize the token metadata
Constructor() {
// Initiate the total token provisioning
Total supply = 1000;
}
// Function to mint a new token
Function mint(Recipient's address, uint amount) public {
// Check if the sender has sufficient balance
Request(msg.sender.hasBalance(), "Insufficient balance");
// Mint the token for the recipient
_mint(Message sender, amount);
}
}
This agreement defines the basic structure of the SPL token with name, symbol and all supply items. The “mint” function allows users to mint new tokens.
Step 3: Create and deploy a contract
Create and deploy your contract:
”smash
cd Solana-token
npx solana-compile –bin contract.solidity
This command compiles your Solidity code into a Solana application that can be deployed on the blockchain.
Step 4: Use the contract in visual code
Create a new file called “index.sol” and add the following code:
strength
import “
main contract {
// Import the SPLToken contract
using SafeERC20 for (address, address);
// Initialize variables
to disrupt the public balance;
// Function to mint a new token
function mint(recipient’s address, uint amount) public {
// SHRINK A TOKEN FOR THE RECIPIENT
balance += sum;
}
// Function to get the current user balance
function getBalance() public view returns (uint) {
refund balance;
}
}
This contract uses the SafeERC20 library to interact with the SPLToken contract. This allows users to mint new tokens and receive their existing balance.
Step 5: Run the contract using VSCode

Create a new file "main.ts" and add the following code:
typewriter
import {account} from ‘@solana/web3.js’;
import “index.sol”;
// Initialize the Solana program
const program = required(‘@sorbe/solana-program’);
// Create new account
async function main() {
const account = wait for getAccount();
console.log(‘Current account balance:’, account.