Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

send_transfer example fails 400 #104

Closed
HerrMuellerluedenscheid opened this issue Dec 5, 2017 · 15 comments
Closed

send_transfer example fails 400 #104

HerrMuellerluedenscheid opened this issue Dec 5, 2017 · 15 comments

Comments

@HerrMuellerluedenscheid
Copy link
Contributor

Hi,

I'm running iri 1.4.1.2 and was trying to run the send_transfer.py example (py3). It terminates with

iota.adapter.BadApiResponse: 400 response from node: This operations cannot be executed: The subtangle has not been updated yet.

What do I have to do to update the subtangle? Do I HAVE to have neighbors to run the examples?

Output of the hello_world.py:

Hello http://localhost:14265/!
{'appName': 'IRI',
 'appVersion': '1.4.1.2',
 'duration': 10,
 'jreAvailableProcessors': 4,
 'jreFreeMemory': 309029696,
 'jreMaxMemory': 1843920896,
 'jreTotalMemory': 763887616,
 'jreVersion': '1.8.0_144',
 'latestMilestone': TransactionHash(b'999999999999999999999999999999999999999999999999999999999999999999999999999999999'),
 'latestMilestoneIndex': 243000,
 'latestSolidSubtangleMilestone': TransactionHash(b'999999999999999999999999999999999999999999999999999999999999999999999999999999999'),
 'latestSolidSubtangleMilestoneIndex': 243000,
 'neighbors': 0,
 'packetsQueueSize': 0,
 'time': 1512461259644,
 'tips': 0,
 'transactionsToRequest': 0}

Thanks for your help in advance!

Best regards

Marius

PS.: for the sake of completeness here the full error stack:

Traceback (most recent call last):
  File "send_transfer.py", line 42, in <module>
    message = TryteString.from_string('Hello!'),
  File "/usr/local/lib/python3.4/dist-packages/PyOTA-2.0.2-py3.4.egg/iota/api.py", line 845, in send_transfer
    minWeightMagnitude  = min_weight_magnitude,
  File "/usr/local/lib/python3.4/dist-packages/PyOTA-2.0.2-py3.4.egg/iota/commands/__init__.py", line 126, in __call__
    self.response = self._execute(self.request)
  File "/usr/local/lib/python3.4/dist-packages/PyOTA-2.0.2-py3.4.egg/iota/commands/extended/send_transfer.py", line 52, in _execute
    trytes              = pt_response['trytes'],
  File "/usr/local/lib/python3.4/dist-packages/PyOTA-2.0.2-py3.4.egg/iota/commands/__init__.py", line 126, in __call__
    self.response = self._execute(self.request)
  File "/usr/local/lib/python3.4/dist-packages/PyOTA-2.0.2-py3.4.egg/iota/commands/extended/send_trytes.py", line 42, in _execute
    gta_response = GetTransactionsToApproveCommand(self.adapter)(depth=depth)
  File "/usr/local/lib/python3.4/dist-packages/PyOTA-2.0.2-py3.4.egg/iota/commands/__init__.py", line 126, in __call__
    self.response = self._execute(self.request)
  File "/usr/local/lib/python3.4/dist-packages/PyOTA-2.0.2-py3.4.egg/iota/commands/__init__.py", line 154, in _execute
    return self.adapter.send_request(request)
  File "/usr/local/lib/python3.4/dist-packages/PyOTA-2.0.2-py3.4.egg/iota/adapter/__init__.py", line 301, in send_request
    return self._interpret_response(response, payload, {codes['ok']})
  File "/usr/local/lib/python3.4/dist-packages/PyOTA-2.0.2-py3.4.egg/iota/adapter/__init__.py", line 438, in _interpret_response
    'response': decoded,
iota.adapter.BadApiResponse: 400 response from node: This operations cannot be executed: The subtangle has not been updated yet.
@HerrMuellerluedenscheid
Copy link
Contributor Author

The reason seems to be lacking neighbors.

However, I find the error message The subtangle has not been updated yet a bit misleading. How about The subtangle is not synchronized, yet? I think update indicates rather a software issue whereas synchronize indicates a networking problem, which points more in the right direction.

@todofixthis
Copy link
Contributor

Hey @HerrMuellerluedenscheid aye, I agree; the error message could probably be clarified.

This message comes directly from the IRI, so the IRI bug tracker is the best place to report this.

That said, I think this error is only relevant so long as the Coordinator is operating — as soon as the COO gets shut down, there will be no "canonical" Tangle that the node has to synchronise with.

@damianme
Copy link

Hi @todofixthis I believe I have a similar error:
BadApiResponse: 400 response from node: Tip not found: 999999999999999999999999999999999999999999999999999999999999999999999999999999999
Does it mean that testnet node is faulty?
Here is my code:
https://github.com/QuantumDamage/iota.lib.py/blob/develop/tutorials/helloworld/helloworld.ipynb

@todofixthis
Copy link
Contributor

Hey Damian. Awesome tutorial; I love where you're going with that!

The error in question is coming from a getBalances request:

~/anaconda3/envs/PyOTA/lib/python3.6/site-packages/iota/commands/extended/prepare_transfer.py in _execute(self, request)
     63 
     64         gb_response = GetBalancesCommand(self.adapter)(
---> 65           addresses = [i.address for i in proposed_inputs],
     66         )
     67 

Since PyOTA doesn't send tips as part of this request, I'm inclined to think that the issue here is on the IRI side of things (and also that the IRI should be sending back a 500 response, not a 400).

@damianme
Copy link

@todofixthis Thanks!
Ok, but I believe we have two problems here. One is 500/400 status (thanks for posting to IRI bug tracker btw.) and second is that I think that when I posted this issue, testtnet node wasn't correctly operational. Now (about 24hours later) I have the correct response. My hint of faulty node is 99999..... in latestSolidSubtangleMilestone
This is comparison of responses from api.get_node_info():

screen shot 2018-02-16 at 8 56 41 am

Does it make sense?
If yes maybe I should add check and description that if there are 999999... there, there is need to search for ohter node?

@todofixthis
Copy link
Contributor

todofixthis commented Feb 17, 2018

That's a really interesting idea. I think that we could turn that into its own feature:

  • A wrapper that, given a collection of node URIs, will (randomly? round-robin? ...) select a node for each API request.
    • A "health check" or similar feature that will (temporarily?) drop a node from the collection if it is determined to be unhealthy.

@damianme
Copy link

@todofixthis Yes, that would be useful for people which are getting started with IOTA. Later when they will be experienced they will be able to change to custom testnet or mainnet nodes without a problem, but at the beginning, this could save them a lot of frustration and time.

@todofixthis
Copy link
Contributor

todofixthis commented Feb 20, 2018

Awesome sauce. I'll log a thing in the issue tracker so that we can add this to the roadmap.

Created #159 and #160

@anistark
Copy link

anistark commented May 8, 2018

I'm still getting this even with iri 1.4.2.4. Has there been any developments or workarounds for this?

@HerrMuellerluedenscheid
Copy link
Contributor Author

Does your iri have neighbors? Is it synchronized?

@MHKhalil
Copy link

MHKhalil commented Aug 5, 2019

@HerrMuellerluedenscheid is it necessary to have neighbors to send transaction??

@anistark
Copy link

anistark commented Aug 5, 2019

@MHKhalil The node that your client lib is connected with must have neighbours.
You can also use one of the publicly available tangle nodes.

@MHKhalil
Copy link

MHKhalil commented Aug 6, 2019

@anistark thank you for your response :)
I have already used the solution of public nodes but now I am trying to interact with the Tangle using a private IRI node.
in fact, I have a node that works on a docker container and i am using a virtual private network (VPN) is it possible to have neighbors with this node?
Thanks for your help in advance!! :)

@anistark
Copy link

anistark commented Aug 6, 2019

@MHKhalil 👍 Ya sure. You can add neighbours. Ask anybody on the fullnode channel on iota discord server and there'll be folks to help you out. I closed my node few months ago or would have added you as neighbour. :)

@MHKhalil
Copy link

MHKhalil commented Aug 6, 2019

@anistark thanks a lot 👍 :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants