Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

212
Views
Hardhat compile error "Expected a value of type HttpNetworkConfig"

I'm attempting to follow the NFT tutorial here. I have set up the accounts on Alchemy and Metamask created the .sol file. I have a .env file in root that looks like this:

API_URL = "https://eth-ropsten.alchemyapi.io/v2/your-api-key"
PRIVATE_KEY = "your-metamask-private-key"

My hardhat config file looks like this:

/**

* @type import('hardhat/config').HardhatUserConfig

*/

require('dotenv').config();

require("@nomiclabs/hardhat-ethers");

const { API_URL, PRIVATE_KEY } = process.env;

module.exports = {

   solidity: {
      compilers: [
        {
          version: "0.5.7"
        },
        {
          version: "0.8.0"
        },
        {
          version: "0.6.12"
        }
      ]
    },

   defaultNetwork: "ropsten",

   networks: {

      hardhat: {},

      ropsten: {

         url: API_KEY,

         accounts: [`0x${PRIVATE_KEY}`]

      }

   },

}

However when I try to compile I keep getting this error:

Invalid value {"url":"https://eth-ropsten.alchemyapi.io/v2/your-api-key","accounts":["0xyour-metamask-private-key"]} for HardhatConfig.networks.ropsten - Expected a value of type HttpNetworkConfig.

I cannot seem to figure out why this is not a valid value for HttpNetworkConfig. What I have where url is a string and accounts is an array would appear to comply with what is in the documentation for network configs. It's a compile error so it would seem it cannot be a problem with the actual url or private key, but maybe I'm wrong about that. I willingly admit to being a noob here with only a cursory understanding of hardhat, solidity, and even js, etc. Any help appreciated.

about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Turns out, the problem was with my private key. Check carefully.

about 4 years ago · Juan Pablo Isaza Report

0

You are probably working at localhost:8545. I think the issue is the value of the assets and some accounts used in your context exist on the mainnet. To solve this problem, you need to hardfork the mainnet to your local.

Please check this guide. https://hardhat.org/hardhat-network/guides/mainnet-forking.html

about 4 years ago · Juan Pablo Isaza Report

0

I was not setting my privateKey to the accounts element.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!