Install & Compatibility
Where this runs
tested against v0.38.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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.722s · 59.1MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 4.6s · import 0.634s · 75MB
69MB installed
● package 69MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
AsyncClient
✓ from solana.rpc.async_api import AsyncClient
✗ from solana.rpc.api import Client
AsyncClient is the recommended client for most modern applications due to Solana's high-throughput nature.
Keypair
✓ from solders.keypair import Keypair
✗ from solana.keypair import Keypair
Core types like Keypair have been moved from `solana.keypair` to `solders.keypair` for improved performance and consistency across Solana Python SDKs.
Pubkey
✓ from solders.pubkey import Pubkey
✗ from solana.publickey import PublicKey
Core types like PublicKey have been moved from `solana.publickey` to `solders.pubkey`.
VersionedTransaction
✓ from solders.transaction import VersionedTransaction
✗ from solana.transaction import Transaction
The `solana.transaction` module is deprecated. Use `solders.transaction` and `VersionedTransaction` for modern transaction formats.
MessageV0
✓ from solders.message import MessageV0
✗ from solana.transaction import Message
The `solana.transaction.Message` class is deprecated. `solders.message.MessageV0` (or `Message`) is the current standard.
This quickstart demonstrates how to connect to the Solana Devnet using `AsyncClient` and fetch the SOL balance of a specified public key. It highlights the use of `solders.pubkey.Pubkey` and the asynchronous nature of `solana-py` interactions. Remember to replace the example public key with a valid one and set `SOLANA_RPC_URL` if not using the default devnet endpoint.
import asyncio
import os
from solders.pubkey import Pubkey
from solana.rpc.async_api import AsyncClient
async def get_sol_balance(public_key_str: str):
"""Fetches the SOL balance of a given public key."""
# Use a devnet RPC endpoint. For production, consider using a dedicated provider.
rpc_url = os.environ.get("SOLANA_RPC_URL", "https://api.devnet.solana.com")
async with AsyncClient(rpc_url) as client:
pubkey = Pubkey.from_string(public_key_str)
try:
response = await client.get_balance(pubkey)
balance_lamports = response.value
balance_sol = balance_lamports / 1_000_000_000 # 1 SOL = 1,000,000,000 lamports
print(f"Account: {public_key_str}")
print(f"Balance: {balance_sol} SOL ({balance_lamports} lamports)")
except Exception as e:
print(f"Error fetching balance: {e}")
if __name__ == "__main__":
# Replace with a real Solana public key (e.g., from a test wallet)
example_public_key = "5Q544fFztbO2Drj9yQ9C7M2f8L2rW3e3H5D2n6H6f8f8" # Example devnet address
asyncio.run(get_sol_balance(example_public_key))
Debug
Known issues
breakingStarting with v0.36.0, support for legacy transaction formats has been removed. Users should migrate to `VersionedTransaction` and `MessageV0` from `solders.transaction` and `solders.message` respectively.fixRewrite transaction creation and signing logic to use `solders.transaction.VersionedTransaction` and `solders.message.MessageV0`. Refer to the latest Solana.py documentation or Cookbook for updated examples.
affects: >=0.36.0
breakingMany core data types (e.g., `Keypair`, `Pubkey`, `Message`, `Transaction`) were migrated from `solana-py`'s internal modules to the `solders` library. Direct imports from `solana.keypair`, `solana.publickey`, or `solana.transaction` for these types are deprecated or will result in errors.fixUpdate imports to use `solders` for core types (e.g., `from solders.keypair import Keypair`, `from solders.pubkey import Pubkey`, `from solders.message import MessageV0`). Ensure `solders` is installed alongside `solana`.
affects: >=0.33.0
deprecatedThe entire `solana.transaction` module and its classes (e.g., `Transaction`, `Message`) are deprecated. Additionally, methods like `get_stake_activation` have been deprecated.fixMigrate to `solders.transaction.VersionedTransaction` and `solders.message.MessageV0` for transaction construction. Replace deprecated RPC methods with their modern equivalents or alternative approaches.
affects: >=0.35.1
gotchaThe `BlockhashCache`, an experimental feature, was removed in v0.33.0 due to it being 'experimental and flawed' and a 'footgun because it broke a lot'.fixRemove any reliance on `BlockhashCache`. Always fetch the latest blockhash directly using `client.get_latest_blockhash()` before constructing transactions.
affects: >=0.33.0
gotchaWhen constructing transactions using `solders.transaction.Transaction` (especially older patterns) or `VersionedTransaction`, incorrect argument types or missing required arguments for the constructor are common, leading to `TypeError` or runtime errors like `argument 'payer': 'Hash' object cannot be converted to 'Pubkey'`.fixCarefully review the `solders` and `solana-py` documentation for the exact constructor signatures for `Transaction` and `VersionedTransaction`. Ensure all required arguments (`from_keypairs`, `message`, `recent_blockhash`) are provided with the correct `solders` types (e.g., `Pubkey` for payer, `MessageV0` for message, `Hash` for blockhash).
affects: All versions using `solders.transaction`
Upgrade
Version history
0.40.3latest on PyPI · released Aug 27, 2026
Audit
Dependencies
soldersrequiredProvides core Solana data structures (Pubkey, Keypair, Message, Transaction) and high-performance Rust bindings. Required for modern `solana-py` usage.
httpxrequiredUsed for synchronous and asynchronous HTTP requests to the Solana RPC endpoint.
websocketsrequiredUsed for WebSocket connections to the Solana RPC endpoint for subscriptions.
pynaclrequiredRequired for cryptographic operations like message signing and verification.