Why is Hardhat throwing an error? I copy n pasted the default config file from https://hardhat.org/config/?
*Error HH8: There's one or more errors in your config file:
Invalid value {"url":"https://eth-rinkeby.alchemyapi.io/v2/xxxxxxxxxx","accounts":[null]} for HardhatConfig.networks.rinkeby - Expected a value of type HttpNetworkConfig.*
To learn more about Hardhat's configuration, please go to https://hardhat.org/config/
/**
* @type import('hardhat/config').HardhatUserConfig
*/
require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-ethers");
require("@nomiclabs/hardhat-truffle5");
require("@nomiclabs/hardhat-etherscan");
require("hardhat-deploy");
require("dotenv").config();
const privateKey1 = process.env.PRIVATE_KEY;
const etherscanKey = process.env.ETHERSCAN_API_KEY;
module.exports = {
defaultNetwork: "rinkeby",
networks: {
hardhat: {},
rinkeby: {
url: "https://eth-rinkeby.alchemyapi.io/v2/oL89FHmvkiWEfUgdjWON4NZBnB-497Is",
accounts: [privateKey1],
},
},
solidity: {
version: "0.8.0",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
paths: {
sources: "./contracts",
tests: "./test",
cache: "./cache",
artifacts: "./artifacts",
},
mocha: {
timeout: 20000,
},
};
privateKey1
is null or undefined. Maybe you are not setting the environment variables correctly?