TokenMarketNet / smart-contracts

Ethereum smart contracts for security and utility tokens
https://tokenmarket.net/
Other
1.34k stars 561 forks source link

Error during deploying the sample crowdsale #82

Open zoltan-molnar opened 6 years ago

zoltan-molnar commented 6 years ago

Hi all,

I don't know if this is my fault or not, but I couldn't deploy the sample code. My first step was to setup everything according to this: https://ico.readthedocs.io/en/latest/install.html Then, I started parity with this command: parity --chain=kovan. I created an address, I also validated it on the main net, then I got some tokens on kovan. After this, I tried to run the following command: deploy-contracts --deployment-file=crowdsales/allocated-token-sale-example.yml --deployment-name=kovan --address=0x00D75b582f6387dDb9fc0f7517350Ed7Ce6B50De

First I got the following error:

(venv) user-machine:ico user$ deploy-contracts --deployment-file=crowdsales/allocated-token-sale-example.yml --deployment-name=kovan --address=0x00D75b582f6387dDb9fc0f7517350Ed7Ce6B50De
Web3 provider is RPC connection http://127.0.0.1:8547
Owner address is 0x00D75b582f6387dDb9fc0f7517350Ed7Ce6B50De
Traceback (most recent call last):
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/urllib3/connection.py", line 141, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/urllib3/util/connection.py", line 83, in create_connection
    raise err
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/urllib3/util/connection.py", line 73, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 357, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1106, in request
    self._send_request(method, url, body, headers)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1151, in _send_request
    self.endheaders(body)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 1102, in endheaders
    self._send_output(message_body)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 934, in _send_output
    self.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py", line 877, in send
    self.connect()
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/urllib3/connection.py", line 166, in connect
    conn = self._new_conn()
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/urllib3/connection.py", line 150, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x1046c2780>: Failed to establish a new connection: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/urllib3/util/retry.py", line 388, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=8547): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1046c2780>: Failed to establish a new connection: [Errno 61] Connection refused',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/b/ico/venv/bin/deploy-contracts", line 9, in <module>
    load_entry_point('ico', 'console_scripts', 'deploy-contracts')()
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/user/b/ico/ico/cmd/deploycontracts.py", line 31, in main
    deploy_crowdsale_from_file(project, deployment_file, deployment_name, address)
  File "/Users/user/b/ico/ico/deploy.py", line 288, in deploy_crowdsale_from_file
    return _deploy_contracts(project, chain, web3, yaml_filename, chain_data, deploy_address)
  File "/Users/user/b/ico/ico/deploy.py", line 269, in _deploy_contracts
    start_balance = from_wei(web3.eth.getBalance(address), "ether")
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/web3/utils/functional.py", line 14, in inner
    value = fn(*args, **kwargs)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/web3/eth.py", line 123, in getBalance
    formatters.input_block_identifier_formatter(block_identifier),
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/web3/providers/manager.py", line 27, in request_blocking
    response_raw = self.provider.make_request(method, params)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/web3/providers/rpc.py", line 52, in make_request
    **self.get_request_kwargs()
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/web3/utils/compat/compat_requests.py", line 21, in make_post_request
    response = session.post(endpoint_uri, data=data, *args, **kwargs)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/requests/sessions.py", line 555, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/requests/adapters.py", line 508, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8547): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x1046c2780>: Failed to establish a new connection: [Errno 61] Connection refused',))

I figured out that this may be, because the port is wrong in populus, so I changed it in populus.json:60 from http://127.0.0.1:8547 to http://127.0.0.1:8546.

It went through on that error, but I got a new one:

(venv) user-machine:ico user$ deploy-contracts --deployment-file=crowdsales/allocated-token-sale-example.yml --deployment-name=kovan --address=0x00D75b582f6387dDb9fc0f7517350Ed7Ce6B50De
Web3 provider is RPC connection http://127.0.0.1:8546
Owner address is 0x00D75b582f6387dDb9fc0f7517350Ed7Ce6B50De
Traceback (most recent call last):
  File "/Users/user/b/ico/venv/bin/deploy-contracts", line 9, in <module>
    load_entry_point('ico', 'console_scripts', 'deploy-contracts')()
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/user/b/ico/ico/cmd/deploycontracts.py", line 31, in main
    deploy_crowdsale_from_file(project, deployment_file, deployment_name, address)
  File "/Users/user/b/ico/ico/deploy.py", line 288, in deploy_crowdsale_from_file
    return _deploy_contracts(project, chain, web3, yaml_filename, chain_data, deploy_address)
  File "/Users/user/b/ico/ico/deploy.py", line 269, in _deploy_contracts
    start_balance = from_wei(web3.eth.getBalance(address), "ether")
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/web3/utils/functional.py", line 14, in inner
    value = fn(*args, **kwargs)
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/web3/eth.py", line 123, in getBalance
    formatters.input_block_identifier_formatter(block_identifier),
  File "/Users/user/b/ico/venv/lib/python3.5/site-packages/web3/providers/manager.py", line 30, in request_blocking
    response = json.loads(force_text(response_raw))
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Any ideas what did I miss or is this really a problem with the package?

jonasjuan commented 6 years ago

i'm having the exact same issue. Exact output with the JSONDecodeError. Help please?

I'm running on ropsten though.

EDIT : think i managed to fix it. had to modify populus to point whatever net youre using to 8545. Works for me.