neo-python icon indicating copy to clipboard operation
neo-python copied to clipboard

Privatenet fails to initialize

Open jseagrave21 opened this issue 6 years ago • 2 comments

Current behavior

When trying to run neo-python using a privatenet, the program hangs and I receive the follow error after exiting using "Ctrl-C":

(venv) jseagrave21@DESKTOP-F7E94IM:/mnt/c/users/jseag/neo/neo-python-coz$ np-prompt -p
Privatenet useragent '/Neo:2.10.2/', nonce: 1195469497
Maxpeers set to  5
[I 190824 23:26:08 LevelDBImpl:45] Created DB at /home/jseagrave21/.neopython/Chains/privnet
[I 190824 23:26:08 Blockchain:164] Current stored headers empty, re-creating from stored blocks...
[I 190824 23:26:08 Blockchain:166] Recreate headers
[I 190824 23:26:08 LevelDBImpl:45] Created DB at /home/jseagrave21/.neopython/Chains/privnet_notif
^CShutting down sync manager...DONE
Shutting down node manager...DONE
Traceback (most recent call last):
  File "/mnt/c/users/jseag/neo/neo-python-coz/venv/bin/np-prompt", line 11, in <module>
    load_entry_point('neo-python', 'console_scripts', 'np-prompt')()
  File "/mnt/c/users/jseag/neo/neo-python-coz/neo/bin/prompt.py", line 393, in main
    loop.run_until_complete(shutdown())
  File "/usr/lib/python3.7/asyncio/base_events.py", line 566, in run_until_complete
    return future.result()
  File "/mnt/c/users/jseag/neo/neo-python-coz/neo/bin/prompt.py", line 376, in shutdown
    await task
  File "/mnt/c/users/jseag/neo/neo-python-coz/neo/Network/nodemanager.py", line 80, in start
    raise e
  File "/mnt/c/users/jseag/neo/neo-python-coz/neo/Network/nodemanager.py", line 74, in start
    await self.loop.create_server(proto, host, port)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 1346, in create_server
    % (sa, err.strerror.lower())) from None
PermissionError: [Errno 13] error while attempting to bind on address ('127.0.0.1', 20333): permission denied

After troubleshooting and receiving advice on Slack, @hal0x2328 led to me a solution: changing the nodeport in the json file to something other than 20333. This is an issue because anyone running the docker image for the privatenet on the same workstation they are using neo-python will run into this problem. The default protocol.privnet.json lists

"SeedList": [
      "127.0.0.1:20333",
      "127.0.0.1:20334",
      "127.0.0.1:20335",
      "127.0.0.1:20336"

And the Nodeport as 20333. Ref: https://github.com/CityOfZion/neo-python/blob/master/neo/data/protocol.privnet.json

Expected behavior

Using the docker image and np-prompt -p, a user should be able to access a privatenet without additional work.

How to reproduce

  • Use the instructions at https://github.com/CityOfZion/neo-privatenet-docker to spin up the latest docker image privatenet.
  • Initialize your venv if applicable
  • Run np-prompt -p

Your environment

Let us know in what environment you're running into the issue:

  • OS: Windows 10, Ubuntu 18.04 LTS
  • neo-python version: 0.8.6-dev
  • Python version: 3.7

jseagrave21 avatar Aug 31 '19 16:08 jseagrave21

I think the discussion here is; should we change the default port of neo-python to not conflict with neo-privatenet if that is running? If so, to what? The issue will still persist when people copy their config files (which is very likely)

ixje avatar Sep 09 '19 11:09 ixje

@ixje perhaps this could be improved with better documentation in https://github.com/CityOfZion/neo-privatenet-docker. I was caught off guard originally because I have been using the privatenet without any additional steps since I started contributing. I am not sure what the best way forward is, my only thought was to make the user experience as simple and as straightforward as possible.

jseagrave21 avatar Sep 10 '19 05:09 jseagrave21