Solana - Create a Fungible Token
Creating a Solana token (spl) involves defining the parameters of the token, such as its supply
and digits
, within a Smart Contract on the Solana chain.
The following steps and examples are based on Solana devnet.
Steps
Step_1: Generate a Solana wallet
Example request:
- Returns an address, a secret key, and a mnemonic
curl --location 'https://api.tatum.io/v3/solana/wallet' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response:
{
"mnemonic": "develop avoid filter category draft napkin innocent elephant potato core expose primary fish horse fever bubble damage lens kite hip select ### ### ###",
"address": "BWmkpRBdW6EvQcsQLEaAbRMvn3VxXxo83su2HZT3fPqh",
"privateKey": "####"
}
Step_2: Add funds to the EOA that will deploy the Smart Contract Fungible Token (Spl)
- Following the address from the example,
"address": "BWmkpRBdW6EvQcsQLEaAbRMvn3VxXxo83su2HZT3fPqh"
- For testnet, you can use a faucet.
Step_3: Check the Native asset balance of an address
Ensure the Sender's blockchain address has enough Native assets to cover the gas fees of the transfer.
Example request:
- Returns address balance in Native asset (SOL)
curl --location 'https://api.tatum.io/v3/solana/account/balance/BWmkpRBdW6EvQcsQLEaAbRMvn3VxXxo83su2HZT3fPqh' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response:
{
"balance": "5"
}
Step_4: Deploy a Smart Contract Fungible Token (ERC-20 or compatible)
Request example:
curl --location 'https://api.tatum.io/v3/blockchain/token/deploy' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"chain": "SOL",
"supply": "200000",
"digits": 6,
"address": "BWmkpRBdW6EvQcsQLEaAbRMvn3VxXxo83su2HZT3fPqh",
"from": "BWmkpRBdW6EvQcsQLEaAbRMvn3VxXxo83su2HZT3fPqh",
"fromPrivateKey": "####"
}'
//response:
{
"txId": {
"txId": "5NoeRRzemkDmhboSWbkJK29fhaXTm3YeAmZo9ALrVZUkr2bHbuTiXgc2dSxKywUEg2YmgjnyMeETgWycyPUHvS4n",
"contractAddress": "HCz6wUe9r9J2BFNT16x7EJjYH6SVjZEdxbe2vQghWubM"
}
}
Good to Know
- Be mindful of Tatum's derivation path. Find additional information in the following article.
- Familiarize yourself with the Safety & Security Basics in the following article.
Updated about 2 months ago