{"id":4765,"library":"solders","title":"Solders","description":"Solders is a high-performance Python toolkit for Solana, providing robust solutions for core SDK functionalities like keypairs, pubkeys, transaction signing and serialization, and RPC request/response parsing. It serves as a Python binding to the Solana Rust SDK, aiming to avoid reimplementing Solana logic in pure Python. While `solana-py` handles network interaction and SPL token clients, `solders` focuses on low-level primitives and offers a `litesvm` module for faster integration testing. The library is actively maintained with frequent updates, with the current version being 0.27.1.","status":"active","version":"0.27.1","language":"en","source_language":"en","source_url":"https://github.com/kevinheavey/solders","tags":["solana","blockchain","cryptocurrency","rust-bindings","web3","sdk","high-performance"],"install":[{"cmd":"pip install solders","lang":"bash","label":"Install solders"}],"dependencies":[],"imports":[{"symbol":"Message","correct":"from solders.message import Message"},{"symbol":"Keypair","correct":"from solders.keypair import Keypair"},{"symbol":"Instruction","correct":"from solders.instruction import Instruction"},{"symbol":"Hash","correct":"from solders.hash import Hash"},{"symbol":"Transaction","correct":"from solders.transaction import Transaction"},{"symbol":"Pubkey","correct":"from solders.pubkey import Pubkey"},{"note":"For network interaction, used in conjunction with solana-py","symbol":"Client","correct":"from solana.rpc.api import Client"}],"quickstart":{"code":"from solders.message import Message\nfrom solders.keypair import Keypair\nfrom solders.instruction import Instruction\nfrom solders.hash import Hash\nfrom solders.transaction import Transaction\nfrom solders.pubkey import Pubkey\n\n# Generate a new keypair for the payer (replace with a real keypair in production)\npayer = Keypair()\n\n# Define a program ID and some arbitrary instruction data\nprogram_id = Pubkey.new_unique() # Using new_unique for a placeholder program ID\narbitrary_instruction_data = bytes([1, 2, 3])\naccounts = [] # For a simple instruction, no accounts might be needed\n\n# Create an instruction\ninstruction = Instruction(program_id, arbitrary_instruction_data, accounts)\n\n# Create a message from the instruction and payer's public key\nmessage = Message([instruction], payer.pubkey())\n\n# Replace with a real blockhash from an RPC call in a real application\n# For demonstration, we use a default hash.\nblockhash = Hash.default() \n\n# Create a transaction\ntx = Transaction([payer], message, blockhash)\n\n# In a real application, you would sign and send the transaction:\n# from solana.rpc.api import Client\n# rpc_client = Client(\"https://api.devnet.solana.com\") # Example RPC URL\n# # For this example, we won't actually send the transaction.\n# # signature = rpc_client.send_transaction(tx).value\n# # print(f\"Transaction sent: {signature}\")\n\nprint(\"Transaction created successfully (not sent in this example).\")\nprint(f\"Payer Public Key: {payer.pubkey()}\")\nprint(f\"Transaction Message: {message}\")\nprint(f\"Transaction: {tx}\")","lang":"python","description":"This quickstart demonstrates how to create a basic Solana transaction using `solders` primitives. It generates a keypair, defines an instruction, constructs a message, and finally builds a transaction. Note that `solders` focuses on data structures and cryptography; network interaction (like sending the transaction) is typically handled by `solana-py`."},"warnings":[{"fix":"Migrate code using `solders.bankrun` to `solders.litesvm`.","message":"In version `0.25.0`, the `solders.bankrun` module was removed in favor of `solders.litesvm`. Users migrating from older versions need to update their testing infrastructure to use `litesvm`.","severity":"breaking","affected_versions":">=0.25.0"},{"fix":"Update calls from `obj.to_bytes_array()` to `obj.to_bytes()`.","message":"As of version `0.25.0`, methods named `to_bytes_array` were renamed to `to_bytes` to accurately reflect the changed return types.","severity":"breaking","affected_versions":">=0.25.0"},{"fix":"Review and update transaction processing logic, using the current `process_transaction` method.","message":"In version `0.18.0`, transaction processing methods were refactored. `process_transaction_with_metadata` was renamed to `process_transaction`, and older methods like `process_transaction_with_preflight` were removed due to being considered 'footguns'.","severity":"breaking","affected_versions":">=0.18.0"},{"fix":"Update code to expect and process `solders.rpc.responses` objects instead of dictionaries for RPC call results. For example, `client.get_balance()` now returns `GetBalanceResp`.","message":"When `solana-py` (which uses `solders` internally) updated its RPC parsing to use `solders`, many RPC methods now return strongly typed objects from `solders.rpc.responses` instead of raw dictionaries. This change affects how RPC results are accessed and processed.","severity":"breaking","affected_versions":"solana-py versions integrated with solders >=0.18.0"},{"fix":"Use `Transaction.populate(signatures)` for adding signatures after transaction creation, and avoid `Transaction.add_signer`.","message":"Related to `solana-py`'s internal use of `solders`, the `Transaction.__init__` method no longer accepts a `signatures` argument. `Transaction.populate` should be used instead to construct transactions with specific signatures. Additionally, `Transaction.add_signer` was removed.","severity":"breaking","affected_versions":"solana-py versions integrated with solders >=0.18.0"},{"fix":"Carefully pin the versions of `solana-py` and `solders` to known compatible combinations and consult both libraries' changelogs for guidance.","message":"Users have reported issues with version mismatches between `solana-py` and `solders`, particularly concerning versioned transactions and unexpected `proxy` arguments in `Client` initialization. It is crucial to ensure compatible versions of both libraries are installed.","severity":"gotcha","affected_versions":"All versions when used with `solana-py`"},{"fix":"Update serialization logic to use methods other than `pickle`, such as the new JSON serialization capabilities.","message":"Pickle support was removed in version `0.25.0`. Applications relying on Python's `pickle` module for serializing `solders` objects will need to transition to alternative serialization methods (e.g., JSON support was added to most classes).","severity":"deprecated","affected_versions":">=0.25.0"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}