Skip to main content

Stellar Python SDK

GitHub Workflow Status Read the Docs PyPI - Downloads Codecov PyPI Stellar Protocol

py-stellar-base is a Python library for communicating with a Stellar Horizon server and Stellar RPC server. It is used for building Stellar apps on Python. It supports Python 3.10+ as well as PyPy 3.11.

It provides:

  • a networking layer API for Horizon endpoints.
  • a networking layer API for Stellar RPC server methods.
  • facilities for building and signing transactions, for communicating with a Stellar Horizon and Stellar RPC instance, and for submitting transactions or querying network history.

Documentation

py-stellar-base's documentation can be found at https://stellar-sdk.readthedocs.io.

Installing

pip install --upgrade stellar-sdk

If you need to use asynchronous, please use the following command to install the required dependencies.

pip install --upgrade stellar-sdk[aiohttp]

If you need to Shamir backup support, please use the following command to install the required dependencies.

pip install --upgrade stellar-sdk[shamir]

We follow Semantic Versioning 2.0.0, and I strongly recommend that you specify its major version number in the dependency file to avoid the unknown effects of breaking changes.

A Simple Example

You can find more examples here.

# Alice pay 10.25 XLM to Bob
from stellar_sdk import Asset, Server, Keypair, TransactionBuilder, Network

alice_keypair = Keypair.from_secret("SBFZCHU5645DOKRWYBXVOXY2ELGJKFRX6VGGPRYUWHQ7PMXXJNDZFMKD")
bob_address = "GA7YNBW5CBTJZ3ZZOWX3ZNBKD6OE7A7IHUQVWMY62W2ZBG2SGZVOOPVH"

server = Server("https://horizon-testnet.stellar.org")
alice_account = server.load_account(alice_keypair.public_key)
base_fee = 100
transaction = (
    TransactionBuilder(
        source_account=alice_account,
        network_passphrase=Network.TESTNET_NETWORK_PASSPHRASE,
        base_fee=base_fee,
    )
    .add_text_memo("Hello, Stellar!")
    .append_payment_op(bob_address, Asset.native(), "10.25")
    .set_timeout(30)
    .build()
)
transaction.sign(alice_keypair)
response = server.submit_transaction(transaction)
print(response)

stellar-contract-bindings

stellar-contract-bindings allows you to generate Python bindings for Stellar Soroban smart contracts, it makes calling Stellar Soroban contracts easier. click here for more information.

stellar-model

stellar-model allows you to parse the JSON returned by Stellar Horizon into the Python models, click here for more information.

Contributing

Contributions are welcome! See CONTRIBUTING.md for more details.

Links

Thank you to all the people who have already contributed to py-stellar-base!

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stellar_sdk-16.1.0.tar.gz (426.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stellar_sdk-16.1.0-py3-none-any.whl (989.0 kB view details)

Uploaded Python 3

File details

Details for the file stellar_sdk-16.1.0.tar.gz.

File metadata

  • Download URL: stellar_sdk-16.1.0.tar.gz
  • Upload date:
  • Size: 426.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for stellar_sdk-16.1.0.tar.gz
Algorithm Hash digest
SHA256 68394217692ec95c91e776701b576c7ee7ad0ce49ceedfa8f14e00d49376d469
MD5 718c3fc9eabb3389d72846db60cf451b
BLAKE2b-256 571cd402dbeb6a96d13e91fa14af0d27355fd49350158eaa0f6db1db5d6d0975

See more details on using hashes here.

File details

Details for the file stellar_sdk-16.1.0-py3-none-any.whl.

File metadata

  • Download URL: stellar_sdk-16.1.0-py3-none-any.whl
  • Upload date:
  • Size: 989.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for stellar_sdk-16.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cabeca39762ba247c0f9b5d5e2be1e849c81f6bf0cb3932a9633955732341d6e
MD5 98980f5848cc984d01b57e4eee491588
BLAKE2b-256 e59e14ec3368b8d4c7f52631a35ba6e1792de373bb2904aec33274fac53a5d4f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

16.1.0 This release

2 files

16.0.0

2 files

15.0.0

2 files

14.1.1

2 files

14.1.0

2 files

14.0.0

2 files

13.2.1

2 files

13.2.0

2 files

13.1.0

2 files

13.0.0

2 files

12.3.0

2 files

12.2.1

2 files

12.2.0

2 files

12.1.0

2 files

12.0.0

2 files

11.1.0

2 files

11.0.0

2 files

10.0.0

2 files

9.4.0

2 files

9.3.0

2 files

9.2.0

2 files

9.1.3

2 files

9.1.2

2 files

9.1.1

2 files

9.1.0

2 files

9.0.0

2 files

8.2.1

2 files

8.2.0

2 files

8.1.1

2 files

8.1.0

2 files

8.0.1

2 files

8.0.0

2 files

7.0.3

2 files

7.0.2

2 files

7.0.1

2 files

7.0.0

2 files

6.1.1

2 files

6.1.0

2 files

6.0.1

2 files

6.0.0

2 files

5.0.1

2 files

5.0.0

2 files

4.2.2

2 files

4.2.1

2 files

4.2.0

2 files

4.1.1

2 files

4.1.0

2 files

4.0.0

2 files

3.3.5

2 files

3.3.4

2 files

3.3.3

2 files

3.3.2

2 files

3.3.1

2 files

3.3.0

2 files

3.2.1

2 files

3.2.0

2 files

3.1.4

2 files

3.1.3

2 files

3.1.2

2 files

3.1.1

2 files

3.1.0

2 files

3.0.0

2 files

3.0.0a1

2 files

2.13.0

2 files

2.12.0

2 files

2.11.3

2 files

2.11.2

2 files

2.11.1

2 files

2.11.0

2 files

2.10.1

2 files

2.10.0

2 files

2.9.0

2 files

2.8.1

2 files

2.8.0

2 files

2.7.0

2 files

2.6.4

2 files

2.6.3

2 files

2.6.2

2 files

2.6.1

2 files

2.6.0

2 files

2.5.3

2 files

2.5.2

2 files

2.5.1

2 files

2.5.0

2 files

2.4.2

2 files

2.4.1

2 files

2.4.0

2 files

2.3.2

2 files

2.3.1

2 files

2.3.0

2 files

2.2.3

2 files

2.2.2

2 files

2.2.1

2 files

2.2.0

2 files

2.1.4

2 files

2.1.3

2 files

2.1.2

2 files

2.1.1

2 files

2.1.0

2 files

2.0.0

2 files

1.4.0

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.4

2 files

1.1.3

2 files

1.1.2

2 files

1.1.0

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0.0

2 files

0.2.4

2 files

0.2.3

1 file

0.2.2

1 file

0.2.1

1 file

0.2.0

1 file

0.1.10

1 file

0.1.9

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page