• This repository has been archived on 13/Jan/2023
  • Stars
    star
    344
  • Rank 118,574 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PyOTA: The IOTA Python API Library


The official Python client library for interacting with the Tangle

Developer documentation portal

Auto-generated docs Discord StackExchange MIT license Supported IRI API endpoints Build status

About โ—ˆ Prerequisites โ—ˆ Installation โ—ˆ Getting started โ—ˆ Examples โ—ˆ Supporting the project โ—ˆ Joining the discussion


About

This is the official Python client library, which allows you to do the following:

  • Create transactions
  • Read transactions
  • Sign transactions
  • Generate addresses

This is beta software, so there may be performance and stability issues. Please report any issues in our issue tracker.

Prerequisites

To install the IOTA Python client library and its dependencies, you need Python version 3.7 or 3.6 installed on your device.

Installation

To download the IOTA Python client library and its dependencies, do the following:

pip install pyota

Installing the optional C extension

PyOTA has an optional C extension that improves the performance of its cryptography features by an average of 60 times.

To install this extension, do the following:

pip install pyota[ccurl]

Installing the optional module for local proof of work

To do proof of work on your local device without relying on a node, you can install the PyOTA-PoW extension module.

To install this extension, use the following command::

pip install pyota[pow]

When you've installed this module, you can use it by passing the local_pow=True argument to your API instance. Doing so will redirect all attach_to_tangle API calls to an interface function in the pow package.

Installing from source

To install the library from the source code on GitHub, do the following:

# Recommended, but not required
Create virtualenv
git clone https://github.com/iotaledger/iota.py.git
pip install -e .

Getting started

After you've installing the library, you can connect to an IRI node to send transactions to it and interact with the ledger. An extended guide can be found on our documentation portal, we strongly recommend you to go here for starting off. A quick starting tutorial is shown below.

To connect to a local IRI node, you can do the following:

from iota import Iota

# Create a new instance of the IOTA API object
# Specify which node to connect to
api = Iota(adapter = 'https://nodes.devnet.iota.org:443')

# Call the `get_node_info()` method for information about the node and the Tangle
response = api.get_node_info()

print(response)

Examples

We have a list of test cases in the examples directory that you can use as a reference when developing apps with IOTA.

Here's how you could send a zero-value transaction, using the library. For the guide, see the documentation portal.

# You don't need a seed to send zero-value transactions
api = Iota('https://nodes.devnet.iota.org:443', devnet=True)

# Define a message to send.
# This message must include only ASCII characters.
message = TryteString.from_unicode('Hello world')

# Define an address.
# This does not need to belong to anyone or have IOTA tokens.
# It must only contain a maximum of 81 trytes
# or 90 trytes with a valid checksum
address = 'ZLGVEQ9JUZZWCZXLWVNTHBDX9G9KZTJP9VEERIIFHY9SIQKYBVAHIMLHXPQVE9IXFDDXNHQINXJDRPFDXNYVAPLZAW'

# Define a zero-value transaction object
# that sends the message to the address
tx = ProposedTransaction(
    address = Address(address),
    message = message,
    value = 0
)

# Create a bundle from the `ProposedTransaction` object
# and send the transaction to the node
result = api.send_transfer(transfers=[tx])

print('Bundle: ')

print(result['bundle'].hash)

Supporting the project

If the IOTA Python client library has been useful to you and you feel like contributing, consider posting a bug report, feature request or a pull request.

We have some basic contribution guidelines to keep our code base stable and consistent.

Running test cases

To run test, do the following:

python setup.py test

PyOTA is also compatible with tox, which will run the unit tests in different virtual environments (one for each supported version of Python).

To run the unit tests, it is recommended that you use the -p argument. This speeds up the tests by running them in parallel.

Install PyOTA with the test-runner extra to set up the necessary dependencies, and then you can run the tests with the tox command::

pip install -e .[test-runner]
tox -v -p all

Building the autogenerated documentation

The autogenerated documentation can be generated on your local device by doing the following:

# Install extra dependencies (you only have to do this once)
pip install .[docs-builder]
cd docs
# Build the documentation::
make html

Joining the discussion

If you want to get involved in the community, need help with getting set up, have any issues related with the library or just want to discuss blockchain, distributed ledgers, and IoT with other people, feel free to join our Discord.

More Repositories

1

legacy-wallet-use-trinity-wallet-instead

IOTA Wallet
JavaScript
2,076
star
2

iri

IOTA Reference Implementation
Java
1,158
star
3

iota.js

IOTA JavaScript
TypeScript
966
star
4

stronghold.rs

Stronghold is a secret management engine written in rust.
Rust
489
star
5

firefly

The official IOTA and Shimmer wallet
TypeScript
478
star
6

trinity-wallet

Trinity is IOTA's old, deprecated wallet. Use Firefly instead.
JavaScript
473
star
7

goshimmer

Prototype implementation of IOTA 2.0
Go
389
star
8

iota.go

IOTA Go API Library. Find documentation on https://wiki.iota.org/build/welcome
Go
356
star
9

hornet

HORNET is a powerful IOTA fullnode software
Go
306
star
10

identity.rs

Implementation of the Decentralized Identity standards such as DID and Verifiable Credentials by W3C for the IOTA Tangle.
Rust
285
star
11

wasp

Node for IOTA Smart Contracts
Go
285
star
12

bee

A framework for IOTA nodes, clients and applications in Rust
Rust
277
star
13

iota.rs

Official IOTA Rust library.
Rust
229
star
14

streams

IOTA Streams, a framework for cryptographic protocols called Applications. Replaces Masked Authenticated Messaging (MAM). Alpha version.
Rust
217
star
15

wallet.rs

Build wallets and other applications involving IOTA value transfer.
Rust
159
star
16

iota-java

IOTA Java API Library. Find documentation on
Java
144
star
17

entangled

enTangle'd is an amalgamation of all things Tangle
C
110
star
18

iota-wiki

IOTA Wiki
TypeScript
109
star
19

tips

Tangle Improvement Proposals for the IOTA technology stack.
JavaScript
86
star
20

android-wallet-app

IOTA Android Wallet Application
Java
82
star
21

iota.legacy.rs

IOTA implementation ( rust )
Rust
77
star
22

chronicle.rs

A framework for building IOTA permanodes
Rust
73
star
23

iota.c

IOTA client library in C
C
67
star
24

crypto.rs

The canonical source of cryptographic ground-truth for IOTA projects that use Rust.
Rust
66
star
25

MAM

Masked Authentication Messaging
Rust
65
star
26

iota.flash.js

JavaScript
64
star
27

iota.lib.csharp

Iota.Lib.Csharp
C#
62
star
28

IOTA-2.0-Research-Specifications

This is the repository of the IOTA 2.0 Research Specifications.
JavaScript
61
star
29

explorer

Explore the IOTA Tangle
TypeScript
60
star
30

hive.go

A Go library containing data structures, various utils and abstractions which are used by both GoShimmer and Hornet.
Go
60
star
31

one-click-tangle

"One Click Tangle" intends to make lives easier to IOTA adopters by providing pre-configured scripts and recipes that allow to deploy IOTA Networks and Nodes "in one click".
Shell
55
star
32

spark-wallet

A low-security wallet intended for short-term use and to send small amounts of IOTA tokens
Svelte
55
star
33

hub

C++
54
star
34

data-marketplace

Proof of Concept Data Marketplace built using MAM and IOTA Tangle.
JavaScript
54
star
35

documentation-platform

Legacy documentation platform
JavaScript
53
star
36

wiki-legacy

These docs have moved!
52
star
37

iota-sdk

The IOTA SDK provides developers with a seamless experience to develop on IOTA by providing account abstractions and clients to interact with node APIs.
Rust
50
star
38

kerl

IOTA is adding an additional hashing function, based on Keccak, with conversion to ternary. The following document describes the functionality and specification to be implemented.
Rust
50
star
39

industry-marketplace

The world's first autonomous and decentralized Industry Marketplace
JavaScript
49
star
40

node-dashboard

TypeScript
45
star
41

compass

Java
44
star
42

iota-core

Go
43
star
43

qupla

A QUbic Programming LAnguage
Java
43
star
44

meta-iota

OpenEmbedded layer for the IOTA Distributed Ledger
BitBake
42
star
45

cli-wallet

Rust
41
star
46

IOTA-2.0-DevNet-wallet

GUI Wallet for use with the IOTA 2.0 DevNet
TypeScript
39
star
47

curl.lib.js

IOTA Proof-of-Work algorithm ported to Javascript to work in WebGL2-enabled browsers
JavaScript
38
star
48

mam.js

Pure JavaScript implementation of MAMv0
TypeScript
37
star
49

poc-ipfs

Demonstration of combining IOTA with IPFS for data storage.
TypeScript
33
star
50

identity.ts

TypeScript
32
star
51

cli-app

CLI App that acts as a wallet
JavaScript
31
star
52

engineering-updates

Periodical updates from the Engineering teams
31
star
53

ccurl

C port of the Curl library
C
30
star
54

integration-services

TypeScript
30
star
55

wasplib

Go
29
star
56

ict

Java
29
star
57

TangleSim

Go
29
star
58

giotan

The CLI Tool for IOTA in Go
Go
28
star
59

chat.ixi

JavaScript
28
star
60

iota.crypto.js

JavaScript
28
star
61

vdf

Implementation of verifiable delay function.
Python
25
star
62

cliri

Coo Less IRI
Java
24
star
63

introduction-docs

Documentation Page for Chrysalis (IOTA 1.5) and Stardust (Shimmer)
JavaScript
24
star
64

docs

IOTA documentation website - PRs welcome!
JavaScript
24
star
65

ledger-iota-app

C
23
star
66

participation-events

22
star
67

HyperledgerFabric-IOTA-Connector

IOTA connector for Hyperledger Fabric Chaincode
Go
22
star
68

selv-mobile

Svelte
21
star
69

chrysalis-faucet

HTML
21
star
70

qubic

Java
20
star
71

iota-area-codes

IACs are a proposed standard for tagging IOTA transactions with a geo-location, which allows them to be fetched based on their location.
TypeScript
19
star
72

fpc-sim

Fast Probabilistic Consensus Simulator
Go
19
star
73

autopeering-sim

Autopeering Simulator
Go
19
star
74

tangle-utils-website

A web site full of utilities for all things tangle, transaction and IOTA.
TypeScript
18
star
75

iota-gui-beta

Beta of IOTA GUI client.
17
star
76

FirstPartyOracle

JavaScript
16
star
77

gh-tangle-release

GitHub Action to publish release details to the Tangle
JavaScript
16
star
78

ledger.rs

Rust
15
star
79

remote-signer

Rust
15
star
80

client-load-balancer

Perform client side load balancing across a list of nodes
TypeScript
15
star
81

bee-meeting-minutes

14
star
82

outdated-mam.client.js

DEPRECATED MAM js client
JavaScript
14
star
83

trade-poc

IOTA Supply Chain Proof-of-Concept
JavaScript
14
star
84

sandbox

Go
14
star
85

access-server

C
14
star
86

mam-explorer

JavaScript
13
star
87

ccurl.interface.js

cCurl Interface for NodeJS
JavaScript
13
star
88

channels-examples

Sample code for IOTA Channels
Rust
13
star
89

bee-rfcs

RFCs to changes to Bee
Shell
13
star
90

inx-chronicle

IOTA permanode implemented using the IOTA Node Extension (INX) interface.
Rust
13
star
91

chronicle

C
13
star
92

esp32-client-sdk

IOTA Client Software Development Kit(SDK) for ESP32
C
13
star
93

seed-migration-tool

IOTA Seed Migration Tool
HTML
12
star
94

iota-css-theme

SCSS
12
star
95

discord-invite-captcha

Simple webserver that will grant you a one-time-use invite for a Discord server if you solve the Captcha.
HTML
12
star
96

drng

Go
12
star
97

tangle.js

Libraries and utilities that make it easier to build applications on the Tangle
TypeScript
12
star
98

streams-examples

Rust
11
star
99

mam.c

C
11
star
100

iota-identity-tutorial

TypeScript
11
star