1

I am trying to run a few simple Python examples and then move to more complex stuff. As a first step I tried to connect to a Node and get info.

Environment:

linux, python 3.9, ota_client_python-0.2.0a3-cp36-abi3-linux_x86_64.whl

Python code:

import iota_client

# iota_node = "http://nodes.thetangle.org:443/" # mainnet
# iota_node = "https://api.lb-0.h.chrysalis-devnet.iota.cafe"
iota_node = "http://api.testnet.shimmer.network:14265/"

client = iota_client.Client( nodes_name_password=[[iota_node]])
print(client.get_info())

Problem:

For each of the 3 iota notes I get the below exception.

Questions:

Are my urls correct? To which node should I connect? I thought mainnet was the save option Or is it recommended to run my own node?

In a second example I like to send a transaction to the Tangle and subsequently read it from the Tangle. Would you recommend to use pyota for this? Or is there a more suitable Python library?

thanks for your help Norbert

---
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: PoisonError { .. }', src/lib.rs:21:20
---------------------------------------------------------------------------
PanicException                            Traceback (most recent call last)
Input In [18], in <cell line: 7>()
      3 # iota_node = "http://nodes.thetangle.org:443/" # 
      4 # iota_node = "https://api.lb-0.h.chrysalis-devnet.iota.cafe"
      5 iota_node = "http://api.testnet.shimmer.network:14265/"
----> 7 client = iota_client.Client( nodes_name_password=[[iota_node]])
      9 print(client.get_info())

PanicException: called `Result::unwrap()` on an `Err` value: PoisonError { .. }

2 Answers 2

1

From what I see the node was changed from a Chrysalis (production) to a Shimmer (develop) node. I added that information in parenthesis, since those are the respective branches of the iota.rs library, which can be found here: https://github.com/iotaledger/iota.rs

A brief introduction to the differences between Chrysalis and Shimmer.

Chrysalis is the actual state of the IOTA mainnet. Launced on Apr 28, 2021 and it has a series of improvements to the original IOTA like:

  • White-flag Approach
  • New Milestone Selection Algorithm
  • URTS Tip Selection
  • Ed25519 Signature Scheme
  • Atomic Transactions
  • Switch to UTXO Model
  • Internal Binary Representation

Detailed information is available here: https://wiki.iota.org/introduction/explanations/update/chrysalis_improvements/

Shimmer is the staging network to IOTA, which means that new functionalities are deployed and tested on Shimmer first.

The previous IOTA protocol, Chrysalis, was optimized for a single application: sending digital money from A to B. The upcoming Stardust upgrade introduces computation and utility to the ledger:

  • Making IOTA an infrastructure and settlement layer for second-layer smart contract chains using IOTA Smart Contracts (ISC).
  • Transforming IOTA into a multi-asset ledger with custom, user-defined tokens using the new tokenization framework.

What this means, is that it is not possible to switch from IOTA (Chrysalis) nodes to Shimmer (Stardust) nodes and use the same libraries or modules.

Now it depends on the goal. If the goal is to test out Shimmer functionalities, it is correct to use the Shimmer node, but then it is suggested to use the latest 1.0.0rc2 Python package available at https://pypi.org/project/iota-client/ with pip install iota-client

After that you can connect to the node and start developing on Shimmer.

This is the get_info example

from iota_client import IotaClient

# Create an IotaClient instance
client = IotaClient({'nodes': ['https://api.testnet.shimmer.network']})

# Get the node info
node_info = client.get_info()
print(f'{node_info}')

Further Shimmer examples for Pyhton are available here: https://github.com/iotaledger/iota.rs/tree/develop/client/bindings/python/examples

0

About nodes: For mainnet, I would suggest to use IOTA Foundation's node load balancer at "https://chrysalis-nodes.iota.org". Your devnet node "https://api.lb-0.h.chrysalis-devnet.iota.cafe" works for me.

About the backtrace. PoisonError usually is a result of calling a Rust API wrapper in a way that is not supposed. I can for example reproduce it when I try to instantiate a client with incorrect URL (resulting in a ReqwestError), then trying to instantiate another one (resulting in a PoisonError).

When experimenting in an interactive Python REPL and you get the error, I'd suggest to close and restart the REPL.

To get longer error messages you can set RUST_BACKTRACE environment variable to full.

2
  • thanks for your feedback. Apr 14 at 6:08
  • your devnet url works for me. This brings me to the next issue. When posing an encrypted message I get: BadApiResponse: 403 response from node: {'error': {'code': '403', 'message': 'Forbidden, error: code=403, message=Forbidden'}} The error is causes by api.send_transfer( transfers=[tx]) What am I missing?? Apr 14 at 6:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.