httpprovidererror related to rpc_url #2405
-
This is the error that I am seeing when I am running the command
I am using mainnet on alchemy instead of rinkeby as its deprecated. I am assuming that the rpc link is not working as I am following the exact steps given in the video. require("@nomiclabs/hardhat-waffle")
require("hardhat-gas-reporter")
require("./tasks/block-number")
require("@nomiclabs/hardhat-etherscan")
require("dotenv").config()
require("solidity-coverage")
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
/**
* @type import('hardhat/config').HardhatUserConfig
*/
const COINMARKETCAP_API_KEY = process.env.COINMARKETCAP_API_KEY || ""
const MAINNET_RPC_URL =
process.env.MAINNET_RPC_URL ||
"https://eth-rinkeby.alchemyapi.io/v2/your-api-key"
const PRIVATE_KEY =
process.env.PRIVATE_KEY ||
"0x11ee3108a03081fe260ecdc106554d09d9d1209bcafd46942b10e02943effc4a"
const ETHERSCAN_API_KEY = process.env.ETHERSCAN_API_KEY || ""
module.exports = {
defaultNetwork: "hardhat",
networks: {
hardhat: {},
mainnet: {
url: MAINNET_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 4,
},
localhost: {
url: "http://localhost:8545",
chainId: 31337,
},
},
solidity: "0.8.8",
etherscan: {
apiKey: ETHERSCAN_API_KEY,
},
gasReporter: {
enabled: true,
currency: "USD",
outputFile: "gas-report.txt",
noColors: true,
coinmarketcap: COINMARKETCAP_API_KEY,
},
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@mayankmalhan123 Please share your deploy.js file Sidenote: I don't see any need to deploy to the mainnet because you'll use real money. Why not use another testnet. I recommend goerli. |
Beta Was this translation helpful? Give feedback.
-
Make sure to use the correct chain ID in The chainId for |
Beta Was this translation helpful? Give feedback.
Make sure to use the correct chain ID in
deploy.js
as well ashardhat.config.js
.The chainId for
goerli
is5