Solana
This guide covers Solana blockchain transactions using the BitPowr API. Solana transactions support native SOL transfers, SPL token transfers, and advanced fee management with custom fee payer addresses for delegated transaction costs.
API Endpoints
1. Estimate Transaction Fee
POST /transactions/estimate
- Get estimated transaction fees before sending
2. Create Solana Transaction
POST /transactions
- Create and send Solana transactions
Estimate Transaction Fees
Before creating Solana transactions, estimate fees to optimize transaction costs and ensure sufficient SOL for fees.
Endpoint
POST /transactions/estimate
Request Headers
Content-Type: application/json
Authorization: Bearer <encodedToken>
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
chain | string | Yes | Must be "SOLANA" |
walletId | string | Yes | Unique identifier for the wallet |
token | string | Yes | Token type (SOL, USDC_SOL, USDT_SOL, etc.) |
tos | array | Yes | Array of destination objects |
from | array | No | Array of sender addresses |
feeAddress | string | No | Address to pay transaction fees |
Example Request
curl --request POST \
--url https://developers.bitpowr.com/api/v1/transactions/estimate \
-H 'content-type: application/json' \
-H 'authorization: Bearer <encodedToken>' \
-d '{
"chain": "SOLANA",
"walletId": "e3455-15b5-46ad-84de-34555",
"token": "USDC",
"tos": [{
"address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"value": "100"
}],
"from": ["5FHwkrdxntdK24b2T3rEFhf2f5w1VWmKhpLjxJKb4YpA"]
}'
Response Format
{
"fee": {
"fast": 0.000005
}
}
Solana Transaction Parameters
Core Parameters
Parameter | Type | Required | Description |
---|---|---|---|
walletId | string | Yes | Unique identifier for the wallet |
assetType | string | Yes | Asset type (SOL, USDC_SOL, USDT_SOL, etc.) |
tos | array | Yes | Array of destination objects |
from | array | No | Array of sender addresses |
description | string | No | Transaction description |
Solana-Specific Parameters
Parameter | Type | Description |
---|---|---|
feeAddress | string | Address to pay transaction fees (natively supported) |
fee | string | Transaction fee in SOL |
Output Object Structure
Parameter | Type | Required | Description |
---|---|---|---|
address | string | Yes | Recipient Solana address (Base58 encoded) |
value | string | Yes | Amount to send (in token units) |
Solana Transaction Types
1. Send SOL Transaction
Send native SOL tokens on the Solana blockchain.
Basic SOL Transfer
curl --request POST \
--url https://developers.bitpowr.com/api/v1/transactions \
-H 'content-type: application/json' \
-H 'authorization: Bearer <encodedToken>' \
-d '{
"walletId": "e3455-15b5-46ad-84de-34555",
"assetType": "SOL",
"from": ["5FHwkrdxntdK24b2T3rEFhf2f5w1VWmKhpLjxJKb4YpA"],
"tos": [{
"address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"value": "0.1"
}],
"description": "SOL transfer"
}'
SOL Transfer with Custom Fee
curl --request POST \
--url https://developers.bitpowr.com/api/v1/transactions \
-H 'content-type: application/json' \
-H 'authorization: Bearer <encodedToken>' \
-d '{
"walletId": "e3455-15b5-46ad-84de-34555",
"assetType": "SOL",
"from": ["5FHwkrdxntdK24b2T3rEFhf2f5w1VWmKhpLjxJKb4YpA"],
"tos": [{
"address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"value": "0.1"
}],
"fee": "0.000005",
"description": "SOL transfer with custom fee"
}'
2. Send SPL Token Transaction
Send SPL (Solana Program Library) tokens like USDC, USDT, or other standard tokens on Solana.
USDC Transfer
curl --request POST \
--url https://developers.bitpowr.com/api/v1/transactions \
-H 'content-type: application/json' \
-H 'authorization: Bearer <encodedToken>' \
-d '{
"walletId": "e3455-15b5-46ad-84de-34555",
"assetType": "USDC_SOL",
"from": ["5FHwkrdxntdK24b2T3rEFhf2f5w1VWmKhpLjxJKb4YpA"],
"tos": [{
"address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"value": "100"
}],
"description": "USDC transfer on Solana"
}'
USDT Transfer
curl --request POST \
--url https://developers.bitpowr.com/api/v1/transactions \
-H 'content-type: application/json' \
-H 'authorization: Bearer <encodedToken>' \
-d '{
"walletId": "e3455-15b5-46ad-84de-34555",
"assetType": "USDT_SOL",
"from": ["5FHwkrdxntdK24b2T3rEFhf2f5w1VWmKhpLjxJKb4YpA"],
"tos": [{
"address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"value": "50"
}],
"description": "USDT transfer on Solana"
}'
SPL Token Transfer with Custom Fee
curl --request POST \
--url https://developers.bitpowr.com/api/v1/transactions \
-H 'content-type: application/json' \
-H 'authorization: Bearer <encodedToken>' \
-d '{
"walletId": "e3455-15b5-46ad-84de-34555",
"assetType": "USDC_SOL",
"from": ["5FHwkrdxntdK24b2T3rEFhf2f5w1VWmKhpLjxJKb4YpA"],
"tos": [{
"address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"value": "100"
}],
"fee": "0.000005",
"description": "USDC transfer with custom fee"
}'
3. Send Transaction with Custom Fee Payer Address
Solana natively supports delegated fee payment, allowing one address to pay transaction fees while another address sends the tokens. This is useful for applications where users don't need to hold SOL for fees.
SOL Transfer with Fee Payer
curl --request POST \
--url https://developers.bitpowr.com/api/v1/transactions \
-H 'content-type: application/json' \
-H 'authorization: Bearer <encodedToken>' \
-d '{
"walletId": "e3455-15b5-46ad-84de-34555",
"assetType": "SOL",
"from": ["5FHwkrdxntdK24b2T3rEFhf2f5w1VWmKhpLjxJKb4YpA"],
"tos": [{
"address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"value": "0.1"
}],
"feeAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"fee": "0.000005",
"description": "SOL transfer with custom fee payer"
}'
SPL Token Transfer with Fee Payer
curl --request POST \
--url https://developers.bitpowr.com/api/v1/transactions \
-H 'content-type: application/json' \
-H 'authorization: Bearer <encodedToken>' \
-d '{
"walletId": "e3455-15b5-46ad-84de-34555",
"assetType": "USDC_SOL",
"from": ["5FHwkrdxntdK24b2T3rEFhf2f5w1VWmKhpLjxJKb4YpA"],
"tos": [{
"address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"value": "100"
}],
"feeAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"fee": "0.000005",
"description": "USDC transfer with custom fee payer"
}'
Multiple Recipients with Fee Payer
curl --request POST \
--url https://developers.bitpowr.com/api/v1/transactions \
-H 'content-type: application/json' \
-H 'authorization: Bearer <encodedToken>' \
-d '{
"walletId": "e3455-15b5-46ad-84de-34555",
"assetType": "USDC_SOL",
"from": ["5FHwkrdxntdK24b2T3rEFhf2f5w1VWmKhpLjxJKb4YpA"],
"tos": [{
"address": "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM",
"value": "50"
}, {
"address": "2mWRmfnRGU9T8KqAjmNjzq3K9Y5vY8X1pZJ4bD7rN9sE",
"value": "30"
}],
"feeAddress": "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",
"fee": "0.00001",
"description": "Multi-recipient USDC transfer with fee payer"
}'
Fee Payer Use Cases
- Gasless User Experience: Applications pay fees so users don't need SOL
- Corporate Payments: Company accounts pay fees for employee transactions
- DeFi Applications: Protocol treasuries cover user transaction costs
- Onboarding: New users can transact without acquiring SOL first
- Payment Processing: Services handle all fee management for customers
Fee Payer Requirements
- SOL Balance: Fee payer address must have sufficient SOL for transaction fees
- Authorization: Fee payer must be controlled by your wallet/application
- Fee Calculation: Estimate fees beforehand to ensure adequate SOL balance
- Native Support: Unlike EVM chains, Solana supports this natively without contracts
Transaction Response Format
All Solana transaction requests return a standardized response.
{
"status": "success",
"data": {
"hash": "5VtSNhB3qfqC6z8j4xM2dY7kP9wR3sA1nF8xE5pL9qG2mH4vC7bN6tK8jD3rX9wS",
"status": "PENDING",
"amount": "100",
"uid": "6680c116-c803-4e46-aa99-2f261cd216ac",
"assetType": "USDC_SOL",
"chain": "SOLANA",
"fee": "0.000005",
"ref": "BTP-SolTx123#ABC456",
"network": "MAINNET"
}
}
Response Fields
Field | Type | Description |
---|---|---|
hash | string | Solana transaction signature (Base58 encoded) |
status | string | Transaction status (PENDING, CONFIRMED, FAILED) |
amount | string | Amount sent in token units |
uid | string | Unique BitPowr transaction identifier |
assetType | string | Token type (SOL, USDC_SOL, etc.) |
chain | string | Always "SOLANA" |
fee | string | Transaction fee paid in SOL |
ref | string | BitPowr reference number |
network | string | Network type (MAINNET, TESTNET, DEVNET) |
Solana Workflow Examples
1. Basic Token Transfer Workflow
1. Estimate fees → POST /estimate-transaction
2. Create transaction → POST /transactions
3. Monitor confirmation using transaction signature
2. Gasless Application Workflow
1. User initiates token transfer
2. Application estimates fees for fee payer account
3. Create transaction with feeAddress parameter
4. Application pays fees, user tokens are transferred
3. Multi-User Service Workflow
1. Service maintains SOL-funded fee payer account
2. Users request token transfers without needing SOL
3. Service creates transactions with central fee payer
4. All users benefit from gasless experience
Best Practices
Fee Management
- Fee Estimation: Always estimate fees before transactions
- SOL Reserves: Maintain adequate SOL balance in fee payer accounts
- Fee Monitoring: Track SOL consumption for fee optimization
- Network Conditions: Monitor network congestion for fee planning
Address Management
- Address Validation: Verify all Solana addresses are valid Base58 strings
- Token Accounts: Ensure recipient has associated token accounts for SPL tokens
- Balance Monitoring: Track balances of all sender and fee payer accounts
Performance Optimization
- Batch Transactions: Use multiple
tos
entries for batch payments - Compute Limits: Monitor compute unit usage for complex transactions
- Retry Logic: Implement retry mechanisms for network issues
- Amount Validation: Verify token amounts and recipient addresses
Error Handling
Common Solana Errors
-
Insufficient SOL for Fees
- Ensure fee payer has adequate SOL balance
- Consider higher fee estimates during network congestion
-
Invalid Address Format
- Validate all addresses are proper Base58 Solana addresses
- Check address length (typically 32-44 characters)
-
Token Account Not Found
- Recipient may need to create associated token account first
- Some SPL tokens require account initialization
-
Network Congestion
- Increase fee amount during high network usage
- Implement retry logic with exponential backoff
-
Compute Budget Exceeded
- Complex transactions may need additional compute units
- Simplify transaction or increase compute budget
Address Format & Requirements
Solana Addresses
- Format: Base58 encoded strings
- Length: Typically 32-44 characters
- Example:
9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
- Validation: Must be valid Base58 without ambiguous characters (0, O, I, l)
Fee Guidelines
- Typical Fee: 0.000005 SOL per signature
- Token Account Fee: 0.00203928 SOL is charged for Token Account
- Network Congestion: Fees may increase during high usage
- Priority Fees: Additional fees can prioritize transactions
- Compute Units: Complex transactions may need more compute budget
Updated 2 days ago