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

ParameterTypeRequiredDescription
chainstringYesMust be "SOLANA"
walletIdstringYesUnique identifier for the wallet
tokenstringYesToken type (SOL, USDC_SOL, USDT_SOL, etc.)
tosarrayYesArray of destination objects
fromarrayNoArray of sender addresses
feeAddressstringNoAddress 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

ParameterTypeRequiredDescription
walletIdstringYesUnique identifier for the wallet
assetTypestringYesAsset type (SOL, USDC_SOL, USDT_SOL, etc.)
tosarrayYesArray of destination objects
fromarrayNoArray of sender addresses
descriptionstringNoTransaction description

Solana-Specific Parameters

ParameterTypeDescription
feeAddressstringAddress to pay transaction fees (natively supported)
feestringTransaction fee in SOL

Output Object Structure

ParameterTypeRequiredDescription
addressstringYesRecipient Solana address (Base58 encoded)
valuestringYesAmount 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

  1. Gasless User Experience: Applications pay fees so users don't need SOL
  2. Corporate Payments: Company accounts pay fees for employee transactions
  3. DeFi Applications: Protocol treasuries cover user transaction costs
  4. Onboarding: New users can transact without acquiring SOL first
  5. 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

FieldTypeDescription
hashstringSolana transaction signature (Base58 encoded)
statusstringTransaction status (PENDING, CONFIRMED, FAILED)
amountstringAmount sent in token units
uidstringUnique BitPowr transaction identifier
assetTypestringToken type (SOL, USDC_SOL, etc.)
chainstringAlways "SOLANA"
feestringTransaction fee paid in SOL
refstringBitPowr reference number
networkstringNetwork 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

  1. Fee Estimation: Always estimate fees before transactions
  2. SOL Reserves: Maintain adequate SOL balance in fee payer accounts
  3. Fee Monitoring: Track SOL consumption for fee optimization
  4. Network Conditions: Monitor network congestion for fee planning

Address Management

  1. Address Validation: Verify all Solana addresses are valid Base58 strings
  2. Token Accounts: Ensure recipient has associated token accounts for SPL tokens
  3. Balance Monitoring: Track balances of all sender and fee payer accounts

Performance Optimization

  1. Batch Transactions: Use multiple tos entries for batch payments
  2. Compute Limits: Monitor compute unit usage for complex transactions
  3. Retry Logic: Implement retry mechanisms for network issues
  4. Amount Validation: Verify token amounts and recipient addresses

Error Handling

Common Solana Errors

  1. Insufficient SOL for Fees

    • Ensure fee payer has adequate SOL balance
    • Consider higher fee estimates during network congestion
  2. Invalid Address Format

    • Validate all addresses are proper Base58 Solana addresses
    • Check address length (typically 32-44 characters)
  3. Token Account Not Found

    • Recipient may need to create associated token account first
    • Some SPL tokens require account initialization
  4. Network Congestion

    • Increase fee amount during high network usage
    • Implement retry logic with exponential backoff
  5. 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