Solana Integration
Solana, known for its high throughput and low transaction fees, is fully supported by Unblock API. This guide highlights Solana-specific considerations for integrating fiat-to-crypto (on-ramp) and crypto-to-fiat (off-ramp) transactions.
🚀 Key Solana Advantages for Payments
- High Speed: Leverage Solana's incredibly fast transaction processing for near-instant payments.
- Low Costs: Benefit from significantly lower transaction fees on the Solana network compared to EVM chains.
- Scalability: Solana's architecture is designed for high scalability, ensuring reliable performance even with increased transaction volume.
➡️ Crypto-to-Fiat Transactions (Off-Ramp) on Solana
A unique aspect of Solana integration is the address activation requirement for off-ramp (crypto-to-fiat) transactions. Here's how to handle it:
Solana Off-Ramp Address Activation
Unlike other supported blockchains, Solana off-ramp addresses (Unblock Solana wallets) are initially inactive. They need to be activated by depositing a small amount of SOL to cover rent exemption.
Activation Steps:
- Retrieve Off-Ramp Address: Use the
/user/wallet/{chain}
or/corporate/{corporate_uuid}/wallet/{chain}
endpoint (specifyingchain: "solana"
) to get the user's Solana off-ramp address. See Get User Wallet API or See Get Corporate Wallet API- The API response includes the
active
status of the address. Initially, it will befalse
.
- The API response includes the
- Determine Rent Exemption: Check the current SOL amount required for rent exemption. You can use:
solana rent 0\`
Example response:
Rent-exempt minimum: 0.00079087 SOL
const { Connection, clusterApiUrl, LAMPORTS_PER_SOL } = require('@solana/web3.js');
const connection = new Connection(clusterApiUrl('mainnet-beta'), 'confirmed');
(async () => {
const minBalance = await connection.getMinimumBalanceForRentExemption(0);
console.log(`Rent-exempt minimum: ${minBalance / LAMPORTS_PER_SOL} SOL`);
})();
- Transfer SOL for Activation: Transfer the required SOL amount to the retrieved Solana off-ramp address.
- Verify Activation: Re-call the wallet endpoint (step 1) to confirm the
active
status is nowtrue
.
⬅️ Fiat-to-Crypto Transactions (On-Ramp) on Solana
For fiat-to-crypto transactions (on-ramping) to Solana, ensure users have provided their target Solana address.
Setting the Target Solana Address
Existing Users: Use the PATCH /user or PATCH /corporate/{corporate_uuid} endpoint to update the target_solana_address parameter in the user or corporate profile. See Update User API or See Update Corporate API
New Users: Include the target_solana_address parameter during user or corporate creation using the POST /user or POST /corporate . See Create User API or See Create Corporate API
Best Practice: Recommend users provide a rent-exempt target Solana address to avoid potential issues with receiving funds. Users can check rent exemption using Solana explorers or SDKs.
Token Preferences for Solana
Configure token preferences for Solana transactions using the PATCH /user/token-preferences or /corporate/{corporate_uuid}/token-preferences endpoint, specifying the chain: "solana". See Update User Token Preferences API or See Update Corporate Token Preferences API
Important Note
Rent exemption is critical for all Solana transactions. Failing to ensure rent exemption for both off-ramp address activation and user-provided target addresses can lead to transaction failures and potential loss of funds for users. Always validate and guide users regarding rent exemption when integrating Solana with Unblock API.
By following these Solana-specific guidelines, you can seamlessly integrate Solana's high-performance blockchain into your platform using Unblock API, offering your users fast and cost-effective crypto transactions.
Updated 17 days ago