Solidity
HTTPError:401 客戶端錯誤:未經授權的 url:https://rinkeby.infura.io/v3/
我收到此錯誤
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/
您
PRIVATE_KEY
可能設置為空字元串。您是否有以下
.env
文件:export PRIVATE_KEY=XXXXX
然後在你的布朗尼配置中:
dotenv: .env wallets: from_key: ${PRIVATE_KEY}
我遇到了同樣的錯誤,問題出在我的項目 ID 上。我不小心在末尾添加了一個額外的“s”。請驗證您的項目 ID。