Solana
Solana (SOL)
Solana can be accessed with the following coin types:
Environment | Coin Type | Faucet |
---|---|---|
Solana Production | sol | |
Solana Testnet | tsol | https://solfaucet.com/ |
Note: Solana Devnet is the primary pre-Mainnet chain for testing by developers and users, whereas Solana Testnet is almost exclusively for validators testing validator client upgrades. For more details on Solana clusters, see their documentation, Solana Clusters.
Explorerhttps://explorer.solana.com/
Generating wallets
1 2 3 4 5 6 7 8 9 10 11
bitgo .coin('tsol') .wallets() .generateWallet({ label: 'My Test Wallet', passphrase: 'secretpassphrase1a5df8380e0e30', }) .then(function (wallet) { // print the new wallet console.dir(wallet); });
1 2 3 4 5 6 7 8
LABEL="My Test Wallet" PASSPHRASE="secretpassphrase1a5df8380e0e30" curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -d "{ \"label\": \"$LABEL\", \"passphrase\": \"$PASSPHRASE\" }" \ http://$BITGO_EXPRESS_HOST:3080/api/v2/tsol/wallet/generate
You can create wallets with a single line of code using the BitGo SDK.
Creating addresses
1 2 3 4 5 6 7 8 9 10 11
bitgo .coin('tsol') .wallets() .getWallet({ id: '636d0c90b221c80007c69365ca8a3508' }) .then(function (wallet) { return wallet.createAddress(); }) .then(function (newAddress) { // print new address details console.dir(newAddress); });
1 2 3 4 5
WALLET=636d0c90b221c80007c69365ca8a3508 curl -X POST \ -H "Authorization: Bearer $ACCESS_TOKEN" \ https://app.bitgo-test.com/api/v2/tsol/wallet/$WALLET/address
Balances
Solana (SOL) is the native asset of the Solana blockchain. The base unit of Solana is a Lamport (1/1000000000) of 1 SOL coin:
- 1 Lamport is (
10-9
) or 0.000000001 SOL. - 1 Solana is (
109
) or 1000000000 Lamport.
Balances are supported in string and number format but string is recommended to ensure values do not exceed the
programmable number limit: balanceString
, confirmedBalanceString
, and spendableBalanceString
.
Solana accounts have a fee to store data on the blockchain, which is referred to as "rent". In order to prevent accounts from paying rent, a minimum balance of 0.002447136 SOL is retained on Solana wallets to make them rent exempt. The minimum balance must stay on your wallet and cannot be spent.
Fee rate
The default fee is 0.00001 SOL for all Hot/Custody/Cold wallet transactions.
Consolidation
In order to consolidate funds into your root address via SDK, you can use the following:
1 2 3 4 5 6 7 8 9 10 11 12
async function consolidate(walletId) { await bitgo.authenticateWithAccessToken({ accessToken }); const unlock = await bitgo.unlock({ otp: '000000', duration: 3600 }); if (!unlock) { console.log('We did not unlock.'); throw new Error(); } const walletInstance = await bitgo.coin(coin).wallets().get({ id: walletId }); const consolidationTxs = await walletInstance.sendAccountConsolidations({ walletPassphrase: walletPassphrase, }); }
Note: Consolidations for SOL have are limited to 25 addresses per transaction.
For consolidations, the coin
value is always sol
or tsol
irrespective of whether you are trying to consolidate native SOL or Solana tokens.
Note: The addresses array should only contain the owner addresses and not the Associated Token Account (ATA) addresses of the tokens.
Associated Token Account (ATA)
Solana supports token assets and token assets are held in a unique account called as Associated Token Account (ATA). An ATA is a Token Account whose address is derived using the wallet's public key, the token's mint, and the token program. These ATAs are owned by the respective address which has the token. Each token asset requires a separate ATA.
When is an ATA Created
First-Time Token Transfer: ATAs are automatically created when transferring tokens to a SOL address for the first time. The sender, or the one initiating the transfer to an address without an ATA, covers the minimum rent fee in SOL (0.00203928 SOL) required to maintain the ATA.
When to Enable ATAs
ATAs must be enabled manually for root addresses. If it’s a HOT wallet, the ATA can be enabled by navigating to the settings page, selecting "Enable Tokens," and then choosing the token and root address. Alternatively, ATA can also be enabled by initiating a token transfer to the root address.
For SMC/custodial wallets, there is no UI option to enable ATAs. Therefore, the only way to enable an ATA on the root address is by sending a small token transfer, which triggers the creation of the ATA.
Impact on SOL Balance
The SOL required to cover rent for the ATA creation will be deducted from the balance of the address that initiates the creation.
Post-First-Time Transfer
Once an ATA is created for a token on an address, subsequent token transfers directly deposit into the ATA, eliminating any further SOL deductions for rent.
Differentiating Between SOL and ATA Transactions
SOL Transfers: Normal SOL transfers do not involve ATAs and can be differentiated by checking if the transaction contains any "Create Account" instructions. Token Transfers with ATA: Token deposits that involve ATA creation will have additional instructions in the transaction explorer (such as "Create Account") and can be identified as such.