SolanaPortal
  • ✨Welcome to SolanaPortal
  • Getting Started
    • ⭐Why SolanaPortal?
    • 📖Guide
    • 🗺️Best Practices
    • ❓FAQ
  • API Documentation
    • Swapping
      • Swapping with Node.js
      • Swapping with Python
      • Swapping with Rust
    • Token Creation
      • Pump.fun Token
      • Standard Token
  • Market Creation
  • ‼️Troubleshooting
  • Support
Powered by GitBook
On this page
  • Error: Invalid or Incorrect Private Key
  • Wallet Address Not Matching the Private Key
  • API Returns Non-200 Status
  • Transaction Fails After Signing
  • Signature Not Found on Solscan
  • Incorrect Dex or Mint Address
  • Slippage Too High or Too Low
  • Debugging Tips

Troubleshooting

When working with the SolanaPortal API and the provided swapping script, you might encounter various errors or issues during execution. Below is a detailed guide on common problems, their potential causes, and steps to resolve them.

Error: Invalid or Incorrect Private Key

Symptom:

  • The script throws an error like: Invalid private key or Error during swap: Invalid secret key length.

Cause:

  • The private key provided in the private_key variable is incorrect, improperly formatted, or incomplete.

Resolution:

  1. Ensure that the private key is in Base58 format.

  2. Double-check that you are not accidentally truncating or miscopying the key.

  3. Validate the private key by decoding it with bs58.decode(private_key) and ensuring no errors occur.

Wallet Address Not Matching the Private Key

Symptom:

  • The wallet.publicKey.toBase58() doesn't match the expected wallet address.

Cause:

  • The private key provided does not correspond to the intended wallet.

Resolution:

  1. Use a key management tool to verify the private key's corresponding public key.

  2. Confirm that the wallet address aligns with your intended trading account.

API Returns Non-200 Status

Symptom:

  • The script logs API Error: followed by the response status or status text, such as Bad Request.

Cause:

  • The request sent to the SolanaPortal API (https://api.solanaportal.io/api/trading) contains invalid or incomplete parameters.

Resolution:

  1. Double-check the request payload (param object) for errors:

    • wallet_address: Ensure it matches the wallet's public key.

    • action: Must be buy or sell.

    • mint: Verify that the mint address corresponds to the correct token.

    • dex: Ensure the specified DEX (raydium, jupiter, etc.) is supported.

    • amount: Provide a valid and precise amount to trade.

    • slippage: Set slippage tolerance appropriately (in numbers, e.g., 90 ).

    • tip: Set a valid tip value.

    • type: Must be jito for Jito transactions.

Transaction Fails After Signing

Symptom:

  • The script logs Transaction failed. Please check the parameters. after sending the transaction to Jito.

Cause:

  • The signed transaction is invalid, incorrectly serialized, or rejected by the Jito block engine.

Resolution:

  1. Verify transaction signing:

    • Ensure the wallet's private key is correctly used to sign the transaction.

    • Confirm that txn.sign([wallet]) properly signs the transaction.

  2. Debug the serialized transaction:

    javascriptCopyEditconsole.log("Serialized Transaction:", txn.serialize());
  3. Check network compatibility:

    • Ensure that the API endpoint (https://tokyo.mainnet.block-engine.jito.wtf/api/v1/transactions) is active and accessible.

    • Validate that your Solana RPC node is not experiencing connectivity issues.

Signature Not Found on Solscan

Symptom:

  • The transaction is marked as succeeded, but the signature URL on Solscan shows Transaction Not Found.

Cause:

  • The transaction has not been confirmed on the Solana blockchain.

Resolution:

  1. Monitor the transaction status:

    • Use Solana's CLI or another explorer to track the transaction:

      bashCopyEditsolana confirm <transaction_signature>
  2. Increase confirmation time:

    • Transactions might take longer to finalize during network congestion. Wait and recheck after a few minutes.

  3. Double-check your RPC node:

    • Ensure the Jito endpoint is correctly configured and functional.

Incorrect Dex or Mint Address

Symptom:

  • The swap fails due to unsupported DEX or an invalid token mint address.

Cause:

  • The DEX or token mint specified in the parameters is not valid or does not support the desired action.

Resolution:

  1. Verify the DEX:

    • Ensure you are using one of the supported platforms (raydium, jupiter, pumpfun, moonshot).

  2. Validate the token mint:

    • Use a token explorer (e.g., Solscan) to confirm the mint address's validity and availability on the selected DEX.

Slippage Too High or Too Low

Symptom:

  • The API rejects the request due to an invalid slippage setting.

Cause:

  • Slippage tolerance is either too restrictive or excessively high.

Resolution:

  1. Adjust the slippage parameter:

    • Use a value between 50 and 100 depending on market volatility.

  2. Test with smaller slippage values and gradually increase if the trade fails.

Debugging Tips

  • Log Everything: Print detailed logs for the request and response to identify issues:

    javascriptCopyEditconsole.log("Request Parameters:", param);
    console.log("API Response:", await response.text());
  • Test Isolated Components: Test signing, transaction creation, and API calls separately to pinpoint errors.

  • Use a Test Wallet: Perform testing with a wallet that contains minimal funds to avoid potential loss.

PreviousMarket CreationNextSupport

Last updated 4 months ago

‼️