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.0.0.tar.gz (425.0 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.0.0-py3-none-any.whl (987.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stellar_sdk-16.0.0.tar.gz
  • Upload date:
  • Size: 425.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.0.0.tar.gz
Algorithm Hash digest
SHA256 18c41fca4e3c5fb86ff5479dc0315e7266a8db09f11185ed207a0d09c7ccc5f5
MD5 4707336520f96ecca8854c537eee9f9b
BLAKE2b-256 df16351625905e2690382e1e30d683d4fbb0abdfa6e15dd9b1af3af00f8cd62c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: stellar_sdk-16.0.0-py3-none-any.whl
  • Upload date:
  • Size: 987.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c478927869acdf65d7f9128dd6f903596a7cf418fc575166b5c40b1d5d9c34bc
MD5 cad2704293784aa15429237bdb6c77df
BLAKE2b-256 a900bd3453ef144de379c7647f9e30675d731dd903013fdbafb57f146bd2089e

See more details on using hashes here.

Release history Release notifications | RSS feed

16.1.0

2 files

This release

16.0.0 This release

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