[英]Python: Error 54 'Connection reset by peer'
我收到以下錯誤:ChunkedEncodingError: ("Connection broken: ConnectionResetError(54, 'Connection reset by peer') 下載時:從https 下載://solc-bin.ethereum.org/macosx-amd64/solc- macosx-amd64-v0.8.11+commit.d7f03943 。請告訴我如何解決這個問題。提前謝謝!
這是代碼:
// SPDX-License-Identifier: MIT
pragma solidity ^0.4.11;
import "@chainlink/contracts/src/v0.4/ERC677Token.sol";
import {StandardToken as linkStandardToken} from "@chainlink/contracts/src/v0.4/vendor/StandardToken.sol";
contract LinkToken is linkStandardToken, ERC677Token {
uint256 public constant totalSupply = 10**27;
string public constant name = "ChainLink Token";
uint8 public constant decimals = 18;
string public constant symbol = "LINK";
function LinkToken() public {
balances[msg.sender] = totalSupply;
}
/**
* @dev transfer token to a specified address with additional data if the recipient is a contract.
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
* @param _data The extra data to be passed to the receiving contract.
*/
function transferAndCall(
address _to,
uint256 _value,
bytes _data
) public validRecipient(_to) returns (bool success) {
return super.transferAndCall(_to, _value, _data);
}
/**
* @dev transfer token to a specified address.
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value)
public
validRecipient(_to)
returns (bool success)
{
return super.transfer(_to, _value);
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value)
public
validRecipient(_spender)
returns (bool)
{
return super.approve(_spender, _value);
}
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
) public validRecipient(_to) returns (bool) {
return super.transferFrom(_from, _to, _value);
}
// MODIFIERS
modifier validRecipient(address _recipient) {
require(_recipient != address(0) && _recipient != address(this));
_;
}
}
這是一條錯誤消息:
Downloading from https://solc-bin.ethereum.org/macosx-amd64/solc-macosx-amd64-v0.8.11+commit.d7f03943
37%|████████████████████████████████████████████▉ | 14.2M/38.5M [00:53<01:32, 264kiB/s]
File "brownie/_cli/__main__.py", line 64, in main
importlib.import_module(f"brownie._cli.{cmd}").main()
File "brownie/_cli/run.py", line 40, in main
active_project = project.load()
File "brownie/project/main.py", line 751, in load
return Project(name, project_path)
File "brownie/project/main.py", line 183, in __init__
self.load()
File "brownie/project/main.py", line 238, in load
self._compile(changed, self._compiler_config, False)
File "brownie/project/main.py", line 95, in _compile
build_json = compiler.compile_and_format(
File "brownie/project/compiler/__init__.py", line 105, in compile_and_format
find_solc_versions(solc_sources, install_needed=True, silent=silent)
File "brownie/project/compiler/solidity.py", line 173, in find_solc_versions
install_solc(*to_install)
File "brownie/project/compiler/solidity.py", line 105, in install_solc
solcx.install_solc(version, show_progress=True)
File "solcx/install.py", line 454, in install_solc
_install_solc_unix(version, filename, show_progress, solcx_binary_path)
File "solcx/install.py", line 603, in _install_solc_unix
content = _download_solc(download, show_progress)
File "solcx/install.py", line 589, in _download_solc
for data in response.iter_content(1024, decode_unicode=True):
File "requests/utils.py", line 536, in stream_decode_response_unicode
for item in iterator:
File "requests/models.py", line 761, in generate
raise ChunkedEncodingError(e)
ChunkedEncodingError: ("Connection broken: ConnectionResetError(54, 'Connection reset by peer')", ConnectionResetError(54, 'Connection reset by peer'))
錯誤出現在solidity編譯器下載中,您可以尋找另一個鏈接來下載它。 solc-bin.ethereum.org已棄用。
這里是更新的鏈接: https://docs.soliditylang.org/en/latest/installing-solidity.html#static-binaries
一條評論:它正在嘗試下載solidity 0.8.11。 即使該代碼適用於版本 ^0.4.11,它也不適用於此編譯器版本。
您可以檢查重大更改
https://docs.soliditylang.org/en/latest/080-break-changes.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.