【问题标题】:solidity ConnectionError: HTTPConnectionPool(host='0.0.0.0', port=7545) #30solidity ConnectionError: HTTPConnectionPool(host='0.0.0.0', port=7545) #30
【发布时间】:2022-02-12 10:04:09
【问题描述】:

Macbook Pro:蒙特雷

英特尔酷睿 i7

布朗尼 v1.17.2

我正在根据参考学习solidity(https://www.youtube.com/watch?v=M576WGiDBdQ&t=25510s)。

在 youtube freedcodecamp 5:41:17 尝试部署到 ganache-local 时,弹出这些错误信息。 在重构成功部署到 ganache UI 和 rinkeby 之前,我将 ganache-local 添加到 brownie network 这个错误弹出。

ConnectionError: HTTPConnectionPool(host='0.0.0.0', port=7545): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd62639d700>: Failed to establish a new connection: [Errno 61] Connection refused'))

完全错误

BronieFundMe2022Project is the active project.

Running 'scripts/deploy.py::main'...
The active network is ganache-local
Deploying Mocks....
  File "brownie/_cli/run.py", line 50, in main
    return_value, frame = run(
  File "brownie/project/scripts.py", line 103, in run
    return_value = f_locals[method_name](*args, **kwargs)
  File "./scripts/deploy.py", line 27, in main
    deploy_fund_me()
  File "./scripts/deploy.py", line 16, in deploy_fund_me
    deploy_mocks()
  File "./scripts/helpful_scripts.py", line 20, in deploy_mocks
    MockV3Aggregator.deploy(DECIMALS,Web3.toWei(STARTING_PRICE,"ether"),{"from":get_account()})
  File "brownie/network/contract.py", line 528, in __call__
    return tx["from"].deploy(
  File "brownie/network/account.py", line 510, in deploy
    receipt, exc = self._make_transaction(
  File "brownie/network/account.py", line 720, in _make_transaction
    gas_price, gas_strategy, gas_iter = self._gas_price(gas_price)
  File "brownie/network/account.py", line 456, in _gas_price
    return web3.eth.generate_gas_price(), None, None
  File "web3/eth.py", line 877, in generate_gas_price
    return self._generate_gas_price(transaction_params)
  File "web3/eth.py", line 173, in _generate_gas_price
    return self.gasPriceStrategy(self.web3, transaction_params)
  File "web3/gas_strategies/rpc.py", line 20, in rpc_gas_price_strategy
    return web3.manager.request_blocking(RPC.eth_gasPrice, [])
  File "web3/manager.py", line 197, in request_blocking
    response = self._make_request(method, params)
  File "web3/manager.py", line 150, in _make_request
    return request_func(method, params)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "web3/middleware/formatting.py", line 76, in apply_formatters
    response = make_request(method, params)
  File "web3/middleware/gas_price_strategy.py", line 90, in middleware
    return make_request(method, params)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "web3/middleware/formatting.py", line 76, in apply_formatters
    response = make_request(method, params)
  File "web3/middleware/attrdict.py", line 33, in middleware
    response = make_request(method, params)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "web3/middleware/formatting.py", line 76, in apply_formatters
    response = make_request(method, params)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "web3/middleware/formatting.py", line 76, in apply_formatters
    response = make_request(method, params)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "web3/middleware/formatting.py", line 76, in apply_formatters
    response = make_request(method, params)
  File "web3/middleware/buffered_gas_estimate.py", line 40, in middleware
    return make_request(method, params)
  File "web3/middleware/exception_retry_request.py", line 105, in middleware
    return make_request(method, params)
  File "web3/providers/rpc.py", line 88, in make_request
    raw_response = make_post_request(
  File "web3/_utils/request.py", line 48, in make_post_request
    response = session.post(endpoint_uri, data=data, *args, **kwargs)  # type: ignore
  File "requests/sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "requests/adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='0.0.0.0', port=7545): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fd62639d700>: Failed to establish a new connection: [Errno 61] Connection refused'))

部署脚本

from brownie import FundMe,network,config,MockV3Aggregator
from scripts.helpful_scripts import (deploy_mocks, get_account,LOCAL_BLOCKCHAIN_ENVIRONMENT)



def deploy_fund_me():
    account = get_account()
    # pass the price feed address to our fundme contract

    # if we are on a persistent network like rinkeby, use the associated address
    # otherwise, deploy mocks
    if network.show_active() not in LOCAL_BLOCKCHAIN_ENVIRONMENT:
        price_feed_address = config["network"][network_showactive()]["eth_usd_price_feed"]
    
    else:
        deploy_mocks()
        price_feed_address = MockV3Aggregator[-1].address

    fund_me = FundMe.deploy(
        price_feed_address,
        {"from":account},
        publish_source=config["networks"][network.show_active()].get("verify"),
        )
    print(f"The contract deploy to {fund_me.address}")

def main():
    deploy_fund_me()

【问题讨论】:

    标签: npm solidity ganache


    【解决方案1】:

    使用“brownie networks delete ganache-local”修复问题,然后重新添加网络。 并将 ganache 端口设置为 8545,chainid 设置为 1337 并重启。

    【讨论】:

      猜你喜欢
      • 2020-07-19
      • 1970-01-01
      • 2018-10-11
      • 2021-01-01
      • 2021-05-17
      • 2014-01-27
      • 2021-07-17
      • 1970-01-01
      • 2021-02-21
      相关资源
      最近更新 更多