1

I'm getting this error

Brownie v1.15.1 - Python development framework for Ethereum

NftMixProject is the active project.
  File "brownie/_cli/__main__.py", line 64, in main
    importlib.import_module(f"brownie._cli.{cmd}").main()
  File "brownie/_cli/run.py", line 43, in main
    network.connect(CONFIG.argv["network"])
  File "brownie/network/main.py", line 55, in connect
    p._load_deployments()
  File "brownie/project/main.py", line 357, in _load_deployments
    contract = ProjectContract(self, build, build_json.stem)
  File "brownie/network/contract.py", line 1291, in __init__
    _DeployedContractBase.__init__(self, address, owner, tx)
  File "brownie/network/contract.py", line 755, in __init__
    self.bytecode = web3.eth.get_code(address).hex()[2:]
  File "web3/module.py", line 57, in caller
    result = w3.manager.request_blocking(method_str,
  File "web3/manager.py", line 180, in request_blocking
    response = self._make_request(method, params)
  File "web3/manager.py", line 141, 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 80, in middleware
    return make_request(method, params)
  File "cytoolz/functoolz.pyx", line 250, in cytoolz.functoolz.curry.__call__
  File "web3/middleware/formatting.py", line 74, in apply_formatters
    response = make_request(method, formatted_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 74, in apply_formatters
    response = make_request(method, formatted_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 74, in apply_formatters
    response = make_request(method, formatted_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 104, 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 49, in make_post_request
    response.raise_for_status()
  File "requests/models.py", line 953, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
HTTPError: 401 Client Error: Unauthorized for url: https://rinkeby.infura.io/v3/

3 Answers 3

1

Your PRIVATE_KEY is likely set to an empty string.

Do you have a .env file with:

export PRIVATE_KEY=XXXXX

and then in your brownie config:

dotenv: .env
wallets:
  from_key: ${PRIVATE_KEY}
0

I got the same error, the problem was with my project id. I accidently added an extra 's' at the end. Kindly verify your project id.

0
  • dropping this comment for future encounters Make sure there is no space around the = operator. I spend a good amount of time finding out the possible causes. That was a type error introduced accidentally. .env

    export PRIVATE_KEY=0xXXXXX

    export WEB3_INFURA_PROJECT_ID=Your_Infura_Project_Id

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.