cosme12 / SimpleCoin

Just a really simple, insecure and incomplete implementation of a blockchain for a cryptocurrency made in Python as educational material. In other words, a simple Bitcoin clone.
http://copitosystem.com
MIT License
1.78k stars 395 forks source link

This program not work correctly on linux #59

Open mateusfg7 opened 4 years ago

mateusfg7 commented 4 years ago

Output error when execute python3 miner.py on terminal:

Traceback (most recent call last):
  File "/home/mateusfg7/Desktop/SimpleCoin/simpleCoin/miner.py", line 267, in <module>
    p2 = Process(target=node.run(), args=b)
  File "/usr/lib/python3/dist-packages/flask/app.py", line 990, in run
    run_simple(host, port, self, **options)
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 1052, in run_simple
    inner()
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 1005, in inner
    fd=fd,
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 848, in make_server
    host, port, app, request_handler, passthrough_errors, ssl_context, fd=fd
  File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 740, in __init__
    HTTPServer.__init__(self, server_address, handler)
  File "/usr/lib/python3.7/socketserver.py", line 452, in __init__
    self.server_bind()
  File "/usr/lib/python3.7/http/server.py", line 137, in server_bind
    socketserver.TCPServer.server_bind(self)
  File "/usr/lib/python3.7/socketserver.py", line 466, in server_bind
    self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/home/mateusfg7/Desktop/SimpleCoin/simpleCoin/miner.py", line 112, in mine
    NODE_PENDING_TRANSACTIONS = json.loads(NODE_PENDING_TRANSACTIONS)
  File "/usr/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.7/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 5 (char 4)
cosme12 commented 4 years ago

Hmm... It looks like you are running something else in that port. May it be possible? I think you can check if the port is in use with $ lsof -i :5000

mateusfg7 commented 4 years ago

image nothing :(

mateusfg7 commented 4 years ago

I used this other command, and was display this: image apparently the port 5000 is being used but, i don't know why

can i change the used port? if yes, how?

cosme12 commented 4 years ago

I though you could change port, but after testing apparently is not that simple. Will let you know if I make it work

mateusfg7 commented 4 years ago

ok :smiley: