Common Errors and Tips

This section provides help on some potential issues you may run into and tips on how to resolve them.

Errors

  • Error HH8: There's one or more errors in your config file
      % npx hardhat compile
      Error HH8: There's one or more errors in your config file:
    
      * Invalid account: #0 for network: rskMainnet - Expected string, received undefined
      * Invalid account: #0 for network: rskTestnet - Expected string, received undefined
    
      To learn more about Hardhat's configuration, please go to https://hardhat.org/config/
    
      For more info go to https://hardhat.org/HH8 or run Hardhat with --show-stack-traces
    • FIX 1: Ensure the values in the environment variables matches with the hardhat network configuration hardhat.config.js file. For bash, run source .env in the root directory for dotenv to enable the environment variables.
  • Error: Nothing to Compile
    % npx hardhat compile
    Nothing to compile
    • FIX 2: Delete artifacts folder and run the npx hardhat compile command to generate new artifacts.
  • Error: "GET /MyToken.json" Error (404): "Not found"
    • Check that contracts were compiled successfully, and artifacts folder was generated.
    • Check that all the steps in interacting with frontend were followed sequentially.
  • Error: HH601: Script scripts/deploy.js doesn't exist.
    • Ensure that you're running the npx hardhat run --network hardhat scripts/deploy.js command from the root directory.

Tips

Issue Solution
Setup and Configuration Issues Double-check environment variables and configuration files for correctness.
Compilation Errors Review Solidity code for syntax errors. Verify the correct Solidity version in the configuration file.
Connection Issues Ensure correct network URL and settings. Maintain a stable internet connection.
Deployment Failures Verify deployment script configuration, account, gas price, and funds.
Truffle Compatibility Issues Adjust Hardhat configurations when migrating from Truffle.
Testing Issues Review test scripts for logical errors. Ensure the right testing libraries and versions.
Debugging Smart Contracts Use Hardhat's debugging tools. Utilize external tools like etherscan.
Gas Estimation Errors Be cautious with gas-intensive operations. Adjust the gas limit or optimize code when needed.
Version Compatibility Keep dependencies up-to-date and compatible.
Community Resources Seek help from online forums, developer communities, and social media platforms like Reddit and GitHub.

Receive updates

Get the latest updates from the Rootstock ecosystem

Loading...