Registry / aws / solders

solders

JSON →
library0.29.0pypypi✓ verified 26d ago

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.

pip install solders
INSTALL
IMPORT
SIG · SOLDERS
S
solders
awspythonv0.29.0
Install
2.0s avg
Import
79ms
Disk
51MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.29.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.078s · 53.3MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.0s · import 0.080s · 54MB
51MB installed
● package 51MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Message
✓ from solders.message import Message
Keypair
✓ from solders.keypair import Keypair
Instruction
✓ from solders.instruction import Instruction
Hash
✓ from solders.hash import Hash
Transaction
✓ from solders.transaction import Transaction
Pubkey
✓ from solders.pubkey import Pubkey
Client
✓ from solana.rpc.api import Client
For network interaction, used in conjunction with solana-py

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`.

from solders.message import Message from solders.keypair import Keypair from solders.instruction import Instruction from solders.hash import Hash from solders.transaction import Transaction from solders.pubkey import Pubkey # Generate a new keypair for the payer (replace with a real keypair in production) payer = Keypair() # Define a program ID and some arbitrary instruction data program_id = Pubkey.new_unique() # Using new_unique for a placeholder program ID arbitrary_instruction_data = bytes([1, 2, 3]) accounts = [] # For a simple instruction, no accounts might be needed # Create an instruction instruction = Instruction(program_id, arbitrary_instruction_data, accounts) # Create a message from the instruction and payer's public key message = Message([instruction], payer.pubkey()) # Replace with a real blockhash from an RPC call in a real application # For demonstration, we use a default hash. blockhash = Hash.default() # Create a transaction tx = Transaction([payer], message, blockhash) # In a real application, you would sign and send the transaction: # from solana.rpc.api import Client # rpc_client = Client("https://api.devnet.solana.com") # Example RPC URL # # For this example, we won't actually send the transaction. # # signature = rpc_client.send_transaction(tx).value # # print(f"Transaction sent: {signature}") print("Transaction created successfully (not sent in this example).") print(f"Payer Public Key: {payer.pubkey()}") print(f"Transaction Message: {message}") print(f"Transaction: {tx}")
Debug
Known issues
breakingIn 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`.
fix
Migrate code using `solders.bankrun` to `solders.litesvm`.
affects: >=0.25.0
breakingAs of version `0.25.0`, methods named `to_bytes_array` were renamed to `to_bytes` to accurately reflect the changed return types.
fix
Update calls from `obj.to_bytes_array()` to `obj.to_bytes()`.
affects: >=0.25.0
breakingIn 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'.
fix
Review and update transaction processing logic, using the current `process_transaction` method.
affects: >=0.18.0
breakingWhen `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.
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`.
affects: solana-py versions integrated with solders >=0.18.0
breakingRelated 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.
fix
Use `Transaction.populate(signatures)` for adding signatures after transaction creation, and avoid `Transaction.add_signer`.
affects: solana-py versions integrated with solders >=0.18.0
gotchaUsers 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.
fix
Carefully pin the versions of `solana-py` and `solders` to known compatible combinations and consult both libraries' changelogs for guidance.
affects: All versions when used with `solana-py`
deprecatedPickle 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).
fix
Update serialization logic to use methods other than `pickle`, such as the new JSON serialization capabilities.
affects: >=0.25.0
Errors
Common errors & fixes
TypeError: an integer is required (got type str)
The `solders.pubkey.Pubkey` constructor expects bytes or an integer, not a base58 string directly.
fix
Use `Pubkey.from_string("BASE58_STRING_HERE")` to create a `Pubkey` from a base58 string.
AttributeError: 'Pubkey' object has no attribute 'to_base58'
In `solders`, the method to get the base58 string representation of a `Pubkey` is `to_base58_string()`, not `to_base58()` as found in `solana-py`.
fix
Replace `my_pubkey.to_base58()` with `my_pubkey.to_base58_string()`.
AttributeError: 'Keypair' object has no attribute 'public_key'
In `solders`, the `Keypair` object provides its public key via the `pubkey()` method, not a `public_key` attribute as found in `solana-py`.
fix
Replace `keypair_object.public_key` with `keypair_object.pubkey()`.
ModuleNotFoundError: No module named 'solders.PublicKey'
The module names in `solders` are lowercase (e.g., `pubkey`), while the class names are title-cased (e.g., `Pubkey`).
fix
Use `from solders.pubkey import Pubkey` (or `from solders.keypair import Keypair`) to correctly import the class.
Upgrade
Version history
0.29.0latest on PyPI · released Aug 13, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
35 hits · last 30 days
node
26
Amazon
1
Resources
solders — pip install solders · libregistry