How to create a Cryptocurrency Token based on Solana Coin

Background

I have always wanted to create a crypto coin/token. I am curious how people create this. After exploring, turn out the easy one is to create a token instead of a coin.

What is the difference between these two? The main difference is that creating a coin is like creating a framework which is more complex compared to creating a program based on the framework.

Let’s create a token first. I use the Solana coin as a based and it has a small gas fee to operate compared with Ethereum.

Let’s get dig to it!!!

What You Need

You need to have the following

  • Virtual Machine on the cloud

Installing and Configuring the Solana

Create a Ubuntu virtual machine.

Install the Solana:

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

Exit the terminal and re-log back in

exit

Create Solana Wallet on the virtual machine:

solana-keygen new

Enter the passphrase empty and hit enter.

The application creates the keypairs and keeps these keypairs safe.

If for some reason, you need to restore this wallet to another machine, as I did 🙂

solana-keygen recover

Under seed phrase, paste the keypairs above from your safe place.

Press the Enter for this question: “If this seed phrase has an associated passphrase, enter it now. Otherwise, press ENTER to continue:”

This will restore the public key (the wallet address) as well as the file itself in

/root/.config/solana/id.json

To check the balance of Solana in this wallet, type in:

solana balance

You should see the balance as 0 SOL

Purchase the Solana with a small of money in your exchange wallet ie. Binance or Coinbase or any.

Note: There is a minimum SOL for each exchange wallet. 0.05 SOL should be enough.

Send the amount that you purchase to your Solana Paper Wallet with a public key (wallet address).

Back into the terminal.

Check the balance:

solana balance

The SOL amount should have something in SOL.

Note: 0.05 SOL should be enough.

The next step, install the Rust for deploying the token.

curl https://sh.rustup.rs -sSf | sh

Enter 1and hit Enter button for Proceed with the installation (default) option.

Exit the terminal and re-log back in

exit

Install the additional package:

sudo apt install libudev-dev

Install the additional package:

sudo apt install libssl-dev pkg-config

Type in Y for “Do you want to continue” question.

Install the additional package:

sudo apt install build-essential -y

Install Solana token CLI program :

cargo install spl-token-cli

Create token:

spl-token create-token

Note: When creating a token, there is a gas fee for that taken out from your paper wallet.

This will generate a token and write down the token id.

Check the balance again:

solana balance

Next, create an account to hold the token above:

spl-token create-account [your-token-id] 

Note: When creating an account, there is a gas fee for that taken out from your paper wallet.

This will generate an account and write down the account id.

Check the balance again:

solana balance

Note: Creating a token and creating an account requires an extra gas fee than a normal transaction fee. The transaction fee is very very very small. Check out the Solana guideline for more detail.

Next, do the printing money (filled up the account with tokens). This is called “minting”.

spl-token mint [your-token-id] [how-many-token-need-to-produce] [your-account-id]

Replace [how-many-token-need-to-produce] with any number of tokens you want. You can have 1 billion if you like.

To check the produced token:

spl-token accounts

The next step is how to transfer the token to other people or do the transaction.

Create a Solana wallet on your phone.

Download the Solflare or Slope Wallet from Apple Store.

Note: Ensure to keep key phrases somewhere safe and do not share with anyone.

Creating Wallet on Browser or Phone

Create a Solana wallet on your browser

Download the Phantom wallet on your browser.

Note: Ensure to keep key phrases somewhere safe and do not share with anyone.

Transfer the token to the Solflare to Phantom Wallet:

spl-token transfer --fund-recipient --allow-unfunded-recipient [your-token-id] [how-much-token-that-need-to-transfer] [your-solflare-or-phantom-wallet-id]  

Back to Phantom wallet on your browser. Check the transaction:

Phantom Wallet

To check your Solana token plus the transaction, go to https://solscan.io and enter the token id.

Solscan