I have create a Private tangle with Hornet, and I setup three peer node for testing.

When I test for sending data with this tutorial, it responses

from iota import Iota, TryteString, Address, Tag, ProposedTransaction
from pprint import pprint

# Declare an API object
api = Iota('http://localhost:14265')

# Prepare custom data
my_data = TryteString.from_unicode('HI,')

# Generate a random address that doesn't have to belong to anyone
my_address = api.get_new_addresses()['addresses'][0]
print("Addr:", my_address)

# Tag is optional here
my_tag = Tag(b'MY9FIRST9TAG')

# Prepare a transaction object
tx = ProposedTransaction(

# Send the transaction to the network
response = api.send_transfer([tx])

Traceback (most recent call last):
  File "/Users/danny/opt/iota/api/sendData.py", line 26, in <module>
    response = api.send_transfer([tx])
  File "/usr/local/lib/python3.9/site-packages/iota/api.py", line 1191, in send_transfer
    return extended.SendTransferCommand(self.adapter)(
  File "/usr/local/lib/python3.9/site-packages/iota/commands/__init__.py", line 130, in __call__
    self.response = self._execute(self.request)
  File "/usr/local/lib/python3.9/site-packages/iota/commands/extended/send_transfer.py", line 53, in _execute
    st_response = SendTrytesCommand(self.adapter)(
  File "/usr/local/lib/python3.9/site-packages/iota/commands/__init__.py", line 130, in __call__
    self.response = self._execute(self.request)
  File "/usr/local/lib/python3.9/site-packages/iota/commands/extended/send_trytes.py", line 49, in _execute
    att_response = AttachToTangleCommand(self.adapter)(
  File "/usr/local/lib/python3.9/site-packages/iota/commands/__init__.py", line 130, in __call__
    self.response = self._execute(self.request)
  File "/usr/local/lib/python3.9/site-packages/iota/commands/core/attach_to_tangle.py", line 41, in _execute
    return super(FilterCommand, self)._execute(request)
  File "/usr/local/lib/python3.9/site-packages/iota/commands/__init__.py", line 158, in _execute
    return self.adapter.send_request(request)
  File "/usr/local/lib/python3.9/site-packages/iota/adapter/__init__.py", line 320, in send_request
    return self._interpret_response(response, payload, {codes['ok']})
  File "/usr/local/lib/python3.9/site-packages/iota/adapter/__init__.py", line 455, in _interpret_response
    raise with_context(
iota.adapter.BadApiResponse: 400 response from node: Wrong MinWeightMagnitude. requested: 14, expected: 5

How can I fix it?


MinWeightMagnitude is one of parameters that determines how PyOTA prepares transactions to broadcast to the network; it is roughly similar to the difficulty value for proof of work.

In this case, the transaction was prepared successfully and transmitted to the node, but the node rejected it because the transaction's MinWeightMagnitude was incorrect (for historical reasons, PyOTA defaults MinWeightMagnitude to 14, but it appears the Hornet node expects it to be 5).

To resolve this, you can specify min_weight_magnitude when calling send_transfer:

# Adjust min_weight_magnitude for Hornet node.
response = api.send_transfer([tx], min_weight_magnitude=5)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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