Search code examples
network-programmingdeploymenthardhat

Hardhat Deploy Error: Error HH100: Network goerli doesn't exist


I'm running into error "HH100: Network goerli doesn't exist" when deploying a smart contract using 'yarn hardhat deploy --network goerli'. See my hardhat.config below. My ".env" file is formatted correctly to my knowledge. Does anyone have insights on what is going on? Thanks!

require("@nomicfoundation/hardhat-toolbox")
require("dotenv").config()
require("hardhat-deploy")

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

const GOERLI_RPC_URL =
      process.env.GOERLI_RPC_URL 
const PRIVATE_KEY = process.env.PRIVATE_KEY
const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY

module.exports = {
    solidity: {
        compilers: [{ version: "0.8.8" }, { version: "0.6.6" }]
    },
    defaultNetwork: "hardhat",
    namedAccounts: {
        deployer: {
            default: 0 //here this will by default take the first account as deployer
        }
    },
    network: {
        goerli: {
            url: GOERLI_RPC_URL,
            accounts: [PRIVATE_KEY],
            chainId: 5,
            blockConfirmation: 6
        }
    }
}

Solution

  • It's not network, It should be networks.

     networks: {
            goerli: {
                url: GOERLI_RPC_URL,
                accounts: [PRIVATE_KEY],
                chainId: 5,
                blockConfirmation: 6
            }
        }