npm Solidity连接错误:HTTP连接池(主机=“0.0.0.0”,端口=7545)#30

rlcwz9us  于 2022-11-14  发布在  其他
关注(0)|答案(3)|浏览(244)

Macbook Pro笔记本电脑:蒙特里
英特尔酷睿i7处理器
布朗尼1.17.2版
我正在根据参考文献(https://www.youtube.com/watch?v=M576WGiDBdQ&t=25510s)学习坚实性。
在youtube freedcodecamp 5:41:17,当试图部署到ganache本地,弹出这些错误信息。在重构部署到ganache用户界面和rinkeby成功,我添加ganache本地到布朗尼网络这个错误弹出。

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()
zsbz8rwp

zsbz8rwp1#

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

lb3vh1jj

lb3vh1jj2#

运行“布朗尼帐户删除(你存储的Ganache地址的帐户名称)然后正常运行你的Ganache

xkftehaa

xkftehaa3#

如果0.0.0.0不起作用,请尝试127.0.0.1,因为具有www.example.com地址的服务器0.0.0.0也会接受www.example.com上的连接127.0.0.1
例如:浏览器网络添加以太坊ganache-本地主机=http://127.0.0.1:8545 chainid=1337

相关问题