Solana - Getting started (REST API)
Generate a Solana wallet, fund it on devnet, check its SOL balance, send SOL, and fetch transaction details with Tatum's v3 Solana REST API.
This article covers the steps required to create a Solana wallet and generate addresses. It includes an example of checking the address balance and transferring funds to another Solana address.
The following steps and examples are based on Solana devnet.
Steps
Step_1: Generate a Solana Wallet
Generating a Solana wallet means creating an account with an address, secret key (private key) an mnemonic. Only one address is generated per mnemonic.
- Tatum does not store Mnemonics and or Private Keys.
- The responsibility of keeping your Mnemonics and Private Keys secure rests solely with you, the User.
- Additional information about Mnemonics and Private Keys is available in the following article.
Example request:
- The response 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 Solana address
We take the address generated in step_1. For testnet, you can get free coins from a faucet. Find additional information in the following article.
{
"address": "BWmkpRBdW6EvQcsQLEaAbRMvn3VxXxo83su2HZT3fPqh"
}Step_3: Check the balance of an Solana account
Request example:
- The response returns the balance of an Solana account
curl --location 'https://api.tatum.io/v3/solana/account/balance/BWmkpRBdW6EvQcsQLEaAbRMvn3VxXxo83su2HZT3fPqh' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response:
{
"balance": "5"
}Step_4: Send SOL from account to account
Request example:
- The response returns a transaction hash
curl --location 'https://api.tatum.io/v3/solana/transaction' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
"from": "BWmkpRBdW6EvQcsQLEaAbRMvn3VxXxo83su2HZT3fPqh",
"to": "8hhPvPKyYWgH2xttVzPWRzwSyTuAxu2fUfsfr59aEG2a",
"amount": "2",
"fromPrivateKey": "####"
}'
//Response
{
"txId": "3uR49BuVHhkfq2daYPN6fLgbf5gd6Qa3CFnBAJpaKx1hybx3TZnhNSBmWyWuC1AScMhvuxP55YUM3r65KAyPzsij"
}Step_5: Get the details of a transaction
Request example:
- The response returns the details of an Solana transaction
curl --location 'https://api.tatum.io/v3/solana/transaction/3uR49BuVHhkfq2daYPN6fLgbf5gd6Qa3CFnBAJpaKx1hybx3TZnhNSBmWyWuC1AScMhvuxP55YUM3r65KAyPzsij' \
--header 'x-api-key: {YOUR_API_KEY}'
//Response
{
"blockTime": 1719524019,
"meta": {
"computeUnitsConsumed": 150,
"err": null,
"fee": 5000,
"innerInstructions": [],
"loadedAddresses": {
"readonly": [],
"writable": []
},
"logMessages": [
"Program 11111111111111111111111111111111 invoke [1]",
"Program 11111111111111111111111111111111 success"
],
"postBalances": [
2994439840,
4949995000,
1
],
"postTokenBalances": [],
"preBalances": [
4994444840,
2949995000,
1
],
"preTokenBalances": [],
"rewards": [],
"status": {
"Ok": null
}
},
"slot": 308623387,
"transaction": {
"message": {
"header": {
"numReadonlySignedAccounts": 0,
"numReadonlyUnsignedAccounts": 1,
"numRequiredSignatures": 1
},
"accountKeys": [
"BWmkpRBdW6EvQcsQLEaAbRMvn3VxXxo83su2HZT3fPqh",
"8hhPvPKyYWgH2xttVzPWRzwSyTuAxu2fUfsfr59aEG2a",
"11111111111111111111111111111111"
],
"recentBlockhash": "H2PQGMvyPEaTyQcn3Y7qfmamcdXDxnESh8TSko9WCFTN",
"instructions": [
{
"accounts": [
0,
1
],
"data": "3Bxs3zxH1DZVrsVy",
"programIdIndex": 2,
"stackHeight": null
}
],
"indexToProgramIds": {}
},
"signatures": [
"3uR49BuVHhkfq2daYPN6fLgbf5gd6Qa3CFnBAJpaKx1hybx3TZnhNSBmWyWuC1AScMhvuxP55YUM3r65KAyPzsij"
]
},
"version": "legacy"
}Good to Know
- There can only be one address per wallet
- To create your own token with this wallet, see Create an SPL token on Solana.
- To mint NFTs without deploying a smart contract, see Solana NFT API: mint and transfer NFTs via Metaplex.
- Familiarize yourself with the Safety & Security Basics in the following article.
Updated 7 days ago
Did this page help you?