Installation¶
PyOTA is compatible with Python 3.7 and 3.6.
Install PyOTA using pip:
pip install pyota[ccurl,pow]
Note
The [ccurl]
extra installs the optional PyOTA-CCurl extension.
This extension boosts the performance of certain crypto operations significantly (speedups of 60x are common).
Note
The [pow]
extra installs the optional PyOTA-PoW extension.
This extension makes it possible to perform proof-of-work
(api call attach_to_tangle
) locally, without relying on an iota node.
Use the local_pow
parameter at api instantiation:
api = Iota('https://nodes.thetangle.org:443', local_pow=True)
Or the set_local_pow()
method of the api class to dynamically
enable/disable the local proof-of-work feature.
Getting Started¶
In order to interact with the IOTA network, you will need access to a node.
You can:
Note that light wallet nodes often disable certain features like PoW for security reasons.
Once you’ve gotten access to an IOTA node, initialize an iota.Iota
object with the URI of the node, and optional seed:
from iota import Iota
# Generate a random seed.
api = Iota('http://localhost:14265')
# Specify seed.
api = Iota('http://localhost:14265', 'SEED9GOES9HERE')
Test your connection to the server by sending a getNodeInfo
command:
print(api.get_node_info())
You are now ready to send commands to your IOTA node!