In order to create a currency on top of the Solana blockchain, we must use the token program provided by the Solana Program Library (which is why they are called SPL tokens). The program source code can be found here, although previous knowledge of how it works is not necessary to proceed with this guide.
Differences Between ERC-20 and SPL Tokens
For currencies to be created on the Ethereum blockchain, you must deploy a smart contract containing the workings of the token you wish to create – usually following a standard such as the ERC-20 one. For Solana, however, there is already a “coin factory” program provided by the official team and all we have to do is pass the correct instructions to this program.
In Solana smart contracts are called programs instead!
Creating a New Token
Step 1
The first prerequisite you will need is the creation of an account and a Project (API Key) on Cryptum Dashboard.
PS: Our dashboard is almost ready! To generate an API Key, contact hello@blockforce.in
Step 2
Supposing you already installed our SDK available on GitHub here, all we need to do is create instantiate it like this:
The “wallet” will receive the newly minted tokens;
”fixedSupply” defines whether future minting is restricted or not;
”decimals” is the number of decimal units for this token (at most 9);
“amount“ refers to the token amount to be first minted;
The wallet now holds all the new tokens and the hash variable contain the token address, which can be inspected in an explorer such as this one or this other one.
Other Functionalities
Besides deploying a token, you can also mint or burn existing tokens.
Minting Tokens
If you’re the token’s Mint Authority, then you can mint extra tokens like this:
Note that the ‘amount’ field takes decimal units into account. For example: the token we created in this guide has two decimal units, so to transfer 20 tokens the amount variable is 20.
The 'token' field can be any custom token available in the blockchain and also the native token in Solana. To transfer native tokens just pass "SOL" as the token.