0

The code is:

require('@nomiclabs/hardhat-waffle')
require('dotenv').config({ path: '.env'})

const ALCHEMY_API_URL = process.env.ALCHEMY_API_URL
const RINKEBY_PRIVATE_KEY = process.env.RINKEBY_PRIVATE_KEY

module.exports = {
  solidity: '0.8.9',
  networks: {
    rinkeby: {
      url: ALCHEMY_API_URL,
      accounts: [RINKEBY_PRIVATE_KEY],
    },
  },
}

It shows following error while running - npx hardhat verify --network rinkeby in the terminal

 Invalid value undefined for HardhatConfig.networks.rinkeby.url - Expected a value of type string.
  * Invalid account: #0 for network: rinkeby - Expected string, received undefined
2
  • Can you log what's the value of ALCHEMY_API_URL when running the config file?
    – Ismael
    Commented Aug 6, 2022 at 17:17
  • show me your .env file. this happens when your keys in .env file not math in config file. Commented Sep 8, 2022 at 14:38

1 Answer 1

0

Don't give path inside config(), hardhat smart enough to know the files Change your line 2

require("dotenv").config()

Mine work after removing path..

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.