I am working with the Solana RPC API using Python to fetch transaction signatures and their details for a specific wallet address. My code is designed to limit requests to avoid hitting the rate limit (supposedly allowing 2 requests per second), yet I'm encountering a 429 Too Many Requests error.

Here's a simplified version of my code:

from solana.rpc.api import Client
from solders.pubkey import Pubkey
from solders.signature import Signature
import time
import json
# Initialize the Solana client for mainnet
client = Client("https://api.mainnet-beta.solana.com")

# The wallet address you're examining
wallet_address = '4prRVFdMipDxxxxxxxxxxjsNzgxGqcG7rjhVLJpEVKJ'

def fetch_all_signatures_and_details(wallet_address):
    # Fetch the transaction signatures for the given wallet address
    signatures = client.get_signatures_for_address(Pubkey.from_string(wallet_address)).to_json()
    # Assuming 'signatures' is your JSON string from the output
    signatures_json = json.loads(signatures)
    # Access the list of transactions in the 'result' key
    signatures = signatures_json
    print(f"Found {len(signatures['result'])} signatures for wallet {wallet_address}. Fetching transaction details...")

    # Limit to processing 2 requests per second
    request_interval = 10 # seconds

    # Iterate over each signature and fetch transaction details
    for signature in signatures['result']:

def get_sol_transfer_details(transaction_signature):
    # Fetch the transaction details
    transaction_details = client.get_transaction(Signature.from_string(transaction_signature)).to_json()
    if transaction_details is None:
        print("Transaction not found.")

    # Assuming 'signatures' is your JSON string from the output
    transaction_details = json.loads(transaction_details)['result']
    # Check if the transaction is a SOL transfer
    if 'transaction' in transaction_details and 'message' in transaction_details['transaction']:
        transaction_message = transaction_details['transaction']['message']
        for instruction in transaction_message['instructions']:
            if 'parsed' in instruction and instruction['parsed']['type'] == "transfer":
                info = instruction['parsed']['info']
                amount_sol = info['lamports'] / 1_000_000_000  # Convert lamports to SOL
                print("SOL Transfer Transaction Details:")
                print(f"Origin (From): {info['source']}")
                print(f"Destination (To): {info['destination']}")
                print(f"Amount: {amount_sol} SOL")
                return  # Assuming only one SOL transfer per transaction for simplicity
        print("This transaction does not contain a SOL transfer.")

# Call the function with the wallet address

Expected Outcome: The script should fetch all transaction signatures and details for the given wallet address without exceeding the rate limits imposed by the Solana API.

Actual Outcome: After successfully processing a few requests, the script throws a 429 Too Many Requests error, suggesting I'm hitting the rate limit.

Error Message:

HTTPStatusError: Client error '429 Too Many Requests' for url 'https://api.mainnet-beta.solana.com'

What I've tried so far:

I ensured my requests are spaced out with a 10-second interval, well above the 2 requests per second limit. I've reviewed the Solana RPC API documentation for any mention of rate limits that might apply differently than I've understood. Despite these efforts, the issue persists. Is there something I'm missing in managing the rate limits with the Solana RPC API, or is there a better way to handle this to avoid the 429 error?

Any guidance or insights would be greatly appreciated!

1 Answer 1


When you get a 429 http status, the status usually comes with a response header Retry-After. This response header gives you the amount of time to delay until the next API call.

If you follow the information given back in the RPC API response headers, you should be able to abide by the given rate limits.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.