0

I have created a one command tangle from this link: https://docs.iota.org/docs/utils/0.1/community/one-command-tangle/overview And using API given here: https://docs.iota.org/docs/node-software/0.1/iri/references/api-reference#broadcasttransactions.

EDIT: I forgot to mention that sudo docker-compose up was giving error, so I pulled coordinator-1264e19 from this link: https://hub.docker.com/r/iotacafe/compass/tags and the command sudo docker-compose upstarted working after this.

I'm trying to broadcast transaction from this node using Python Library, but I'm getting this error:

"urlopen error [WinError 10061] No connection could be made because the target machine actively refused it"

My code is:

import urllib.request
import urllib.parse
import json

command = {
  "command": "broadcastTransactions",
  "trytes": ["P9KFSJVGSPLXAEBJSHWFZLGP ..."]
}

stringified = json.dumps(command)

headers = {
    'content-type': 'application/json',
    'X-IOTA-API-Version': '1'
}

url="http://localhost:14265"
fo = urllib.parse.urlencode(command)
#fo = urllib2.urlunparse(command)
fo = fo.encode('utf-8')
request = urllib.request.Request(url, fo)
returnData = urllib.request.urlopen(request).read()

jsonData = json.loads(returnData)

print (jsonData)

My node is running on ubuntu machine: Text](https://stackoverflow.com/image.jpg[![enter image description here]1)

This is very important work for me. If I can get any guidance regarding this error and how to resolve it, I would be very thankful.

  • It is unclear for me from where you try to connect. As you connect to localhost, I hope both your node and your python code are running on the same machine/VM? As Compass can issue milestones, it can connect to iri - can you check netstat if the correct process is listening? – mihi Apr 21 at 20:13
  • 1
    I just noticed that you got error 10061 which is a Windows error code. What kind of Python are you running on your Ubuntu machine? Python in WINE? Then better try the native Python, as otherwise you might have to deal with some network address mappings... – mihi Apr 21 at 20:15
  • On my laptop, I'm running Python 3.7.7. I'm running Python script on VS Code. And my node is running on Ubuntu hosted on Amazon AWS. Python version on Ubuntu is Python 2.7.17 – degr8sid Apr 22 at 7:30
  • 1
    Then you first have to allow outside connections in your node, and then you need to make sure the AWS firewall has that port open. You can verify with telnet or a web browser. Last but not least, you do not want to connect to localhost, but to the name/ip of your AWS machine. – mihi Apr 22 at 9:10
  • My Ubuntu has an IP, so I have to use that IP instead of localhost? Also, how do I allow outside connection to my IOTA node? – degr8sid Apr 22 at 10:19

Your Answer

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

Browse other questions tagged or ask your own question.