Skip to main content

Getting Started with Python

Safe Password Storage

In a production setup, do not store passwords in the host's environment variables or in the source code. See our backup and security recommendations for production setups.

Requirements​

Install the IOTA SDK​

Install Using a Pip​

To start using the IOTA SDK in your Python project, you can use pip to install:

pip install iota-sdk

Build the Binding from Source​

  1. Move to the Python bindings directory:
cd iota-sdk/bindings/python
  1. (optional) You can run the following commands create a virtual environment and use it:
python3 -m venv iota_sdk_venv
source iota_sdk_venv/bin/activate
  1. Install the required dependencies and build the wheel by running the following commands:
pip install -r requirements-dev.txt
pip install .
  1. (optional) If you want to deactivate the virtual environment, run the following command:
deactivate

Usage​

Client​

After you installed the library, you can create a Client instance and interface with it.

bindings/python/examples/client/getting_started.py
loading...

Wallet​

After you installed the library, you can create a Wallet instance and interact with it.

bindings/python/examples/wallet/getting_started.py
loading...

What's next?​

How-To Guides​

Once you have installed the IOTA SDK, you can start building your application. You can find usage examples in this Wiki's how-to guides.

More Examples​

You can use the provided code examples to get acquainted with the IOTA SDK. You can use the following command to run any example:

python3 example/[example file]
  • Where [example file] is the file name from the example folder. For example:
python3 examples/client/00_get_info.py

API Reference​

You can generate the Python API reference with the following command from this directory:

pip install pydoc-markdown && pydoc-markdown

API Reference​

The IOTA SDK Rust API Reference is in the crate documentation.