Skip to main content

Getting Started with Python

Alpha Software

The IOTA SDK is currently in alpha. APIs, interfaces, and behavior may change without notice between releases. It is not yet recommended for production use.

The IOTA SDK Python bindings allow you to interact with the IOTA network using Python. These bindings wrap the core Rust SDK, providing a high-level and "pythonic" interface for developers.

Prerequisites​

Before using the Python bindings, ensure you have:

  • Python: Version 3.8 or higher.
  • pip: Python package installer.
  • Virtual Environment (Recommended): To manage dependencies cleanly.

Installation​

You can install the IOTA SDK directly from PyPI:

pip install iota-sdk==3.0.0-alpha.1

The package includes pre-compiled binary wheels for Windows, macOS, and Linux, so no Rust compiler is required for standard installation.

Quick Start Example​

The following example demonstrates how to connect to the IOTA Testnet and retrieve the Chain ID.

1. Create a script​

Create a new file named main.py and paste the following code:

bindings/python/examples/chain_id.py
loading...

2. Run the code​

In your terminal, run:

python main.py

What's Next?​

Now that you have connected to the network, you can explore more advanced features:

  • Accounts and Addresses: create a mnemonic, derive addresses, and check coin balances.
  • Transactions: build, sign, and send Programmable Transaction Blocks (PTBs), including staking and reusing command results.
  • Queries: query owned objects, events, and transactions with the GraphQL client.

View more comprehensive examples in the official Python examples directory.