{"id":24657,"library":"stellar-sdk","title":"Stellar SDK","description":"The Python Stellar SDK provides APIs to build transactions, interact with Horizon and Stellar RPC servers, and support Soroban smart contracts. Version 13.2.1 supports Protocol 23, SEP-45, and async operations. Released roughly monthly on GitHub.","status":"active","version":"13.2.1","language":"python","source_language":"en","source_url":"https://github.com/StellarCN/py-stellar-base","tags":["stellar","blockchain","horizon","soroban","sdk","transactions"],"install":[{"cmd":"pip install stellar-sdk","lang":"bash","label":"stable"}],"dependencies":[{"reason":"async HTTP client for Stellar RPC","package":"aiohttp","optional":false},{"reason":"key generation and signing","package":"cryptography","optional":false}],"imports":[{"note":"Server was moved to stellar_sdk.server in v10+","wrong":"from stellar_sdk import Server","symbol":"Server","correct":"from stellar_sdk.server import Server"},{"note":"Always use explicit import path","symbol":"TransactionBuilder","correct":"from stellar_sdk.transaction_builder import TransactionBuilder"},{"note":"Keypair is in its own module","symbol":"Keypair","correct":"from stellar_sdk.keypair import Keypair"},{"note":"For Soroban RPC interactions","symbol":"SorobanServer","correct":"from stellar_sdk.soroban_server import SorobanServer"}],"quickstart":{"code":"from stellar_sdk.keypair import Keypair\nfrom stellar_sdk.server import Server\n\nserver = Server(horizon_url=\"https://horizon-testnet.stellar.org\")\nkeypair = Keypair.random()\nprint(f\"Public: {keypair.public_key}, Secret: {keypair.secret}\")\naccount = server.load_account(keypair.public_key)\nprint(f\"Sequence: {account.sequence}\")","lang":"python","description":"Generate a random keypair and load its account from the testnet."},"warnings":[{"fix":"Review usage of `StrKey.decode_ed25519_public_key` or similar; ensure encoded data still works as expected.","message":"In v13.0.0, `StrKey` added support for med25519, liquidity pools, and claimable balances. Existing encoded strings may change interpretation.","severity":"breaking","affected_versions":">=13.0.0"},{"fix":"Access `diagnostic_events_xdr` via `GetTransactionResponse` or `Transaction` objects.","message":"`diagnostic_events_xdr` has been removed from `stellar_sdk.soroban_rpc.Events`. Use `GetTransactionResponse.diagnostic_events_xdr` instead.","severity":"deprecated","affected_versions":"13.2.0+"},{"fix":"Always pass `start_ledger` explicitly when paginating to avoid missing events.","message":"`SorobanServer.get_events()` and similar paginated methods: `start_ledger` is optional, but if omitted the server may return unexpected results.","severity":"gotcha","affected_versions":">=12.2.1"},{"fix":"Ensure any metadata deserialization code is updated for the new XDR format (v4).","message":"From v13.0.0, Transaction meta handling is updated for Protocol 23 v4. Older meta formats may not parse correctly.","severity":"breaking","affected_versions":">=13.0.0"},{"fix":"Use `stellar_sdk.Network.TESTNET_NETWORK_PASSPHRASE` or `Network.PUBLIC_NETWORK_PASSPHRASE`.","message":"When creating a `TransactionBuilder`, you must provide a valid `network_passphrase`. Using the wrong passphrase (e.g., testnet vs public) will cause submission failures.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from stellar_sdk.server import Server`","cause":"Server is not directly under stellar_sdk; it's in a submodule.","error":"AttributeError: module 'stellar_sdk' has no attribute 'Server'"},{"fix":"Match the horizon_url to the network: testnet -> https://horizon-testnet.stellar.org, public -> https://horizon.stellar.org","cause":"Using a public network Horizon URL for a testnet account, or vice versa.","error":"stellar_sdk.exceptions.NotFoundError: Resource not found"},{"fix":"Ensure the destination account exists on the network and is a valid Stellar address.","cause":"Payment operation has no destination account or invalid destination.","error":"stellar_sdk.exceptions.BadRequestError: ... \"op_no_destination\""}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}