1. Mythril fails to import remotely and all-time searches in the local file system - to solve this I used Hardhat to compile my contract - and hardhat compiled contract.

  2. Now I am stuck on How to run Mythril on the contract using Hardhat to compile the solidity file.

npx hardhat compile // this comiles contract
myth -a FILENAME.sol --execution-timeout 10 // 

myth compiles file.sol using solc compiler and again giving import error - NOW HOW TO USE HARDHAT compiled solidity and RUN it on mythril.

1 Answer 1


It maybe too late to help you but I answer for the others.

As this github issue said, Mythril compiles solidity with solc. https://github.com/ConsenSys/mythril/issues/1621

please set remappings to solc.json like

    "remappings": [ "@openzeppelin/=node_modules/@openzeppelin/" ],
    "optimizer": {
        "enabled": true

and run

myth analyze contracts/hoge.sol --solc-json solc.json --execution-timeout 20

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.