1

I'm using HardHat (repo) behind a firewall, requiring outbound connections to use a proxy. This is usually pretty easy, for example to configure NPM for using proxy, you can set environment variables HTTP_PROXY and HTTPS_PROXY.

In HardHat, when running commands like npx hardhat compile, HardHat reaches out to https://solc-bin.ethereum.org/windows-amd64/list.json to get the latest version list of the solidity compiler solc. The command fails because it cannot reach out to that address, making the fetch fail and subsequently the command fail. (Error message is below with Stack Trace)

Is there...

A) Configure HardHat to work with a proxy?

or

B) Manually install solc (with something like yarn add solc and update hardhat.config.js) and disable HardHat from checking for a list of compilers and installing a compiler?

Error:

HardhatError: HH502: Couldn't download compiler versions list. Please check your connection.
    at CompilerDownloader.downloadCompilersList (C:\Projects\myProject\node_modules\hardhat\src\internal\solidity\compiler\downloader.ts:185:13)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)

    Caused by: FetchError: request to https://solc-bin.ethereum.org/windows-amd64/list.json failed, reason: read ECONNRESET
        at ClientRequest.<anonymous> (C:\Projects\myProject\node_modules\node-fetch\lib\index.js:1461:11)
        at ClientRequest.emit (events.js:315:20)
        at TLSSocket.socketErrorListener (_http_client.js:426:9)
        at TLSSocket.emit (events.js:315:20)
        at emitErrorNT (internal/streams/destroy.js:92:8)
        at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
        at processTicksAndRejections (internal/process/task_queues.js:84:21)

Edit/Update:

I found the task name subtask(TASK_COMPILE_SOLIDITY_RUN_SOLCJS) to compile using solcjs. Is there a way to configure solcjs as the default compiler? Possibly through an ENV variable?

Update May 2021:

1

They are trying to resolve this issue.

https://github.com/nomiclabs/hardhat/pull/1291

7
  • Yes. I’ve been waiting on the PR to be merged for a little while. If you’re waiting on this too, please add a comment or “up vote” the issue github.com/nomiclabs/hardhat/issues/1280 related to the PR – DogEatDog May 2 at 14:46
  • 1
    Done. Hope this feature can be added soon. – beijingjazzpanda May 4 at 5:40
  • Agreed. I’ve been waiting since March and cannot wait any longer. I’ll have to use truffle and web3 possibly. Is there a way to use ethers with mocha with truffle? – DogEatDog May 4 at 12:17
  • You can use ethers.js as an independent package in your truffle project. ethereum.stackexchange.com/questions/50632/… – beijingjazzpanda May 5 at 4:39
  • 1
    Compare with Java, Blockchain=server+db, evm=jvm, solidity=java, hardhat/truffle=eclipse, oppenzepellin=spring framework, ethers/web3=RESTful API, ABI=API controller. – beijingjazzpanda May 5 at 4:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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