Reputation: 857
When I run
npx hardhat console --network rinkeby
accounts = await ethers.provider.listAccounts();
I get
Uncaught ProviderError: Must be authenticated!
with below rinkeby network config in hardhat.config.js
rinkeby: {
url: "ALCHEMY_URL",
accounts:["YOUR_PRIVATE_KEY"],
}
Upvotes: 4
Views: 3090
Reputation: 107
There is some issue with your provider URL, try it without env first. it will work
Upvotes: 0
Reputation: 138
Finally, your hardhat.config.js
should look like this
require('@nomiclabs/hardhat-waffle');
module.exports = {
solidity: '0.8.0',
networks: {
ropsten: {
url: `${ARCHEM_APP_URL}`,
accounts: [`${ACCOUNT_KEY}`],
gas: 2100000,
gasPrice: 8000000000,
saveDeployments: true,
}
}
}
Upvotes: 0
Reputation: 857
Solution: update config file with below lines:
rinkeby: {
url: "ALCHEMY_URL",
accounts: ["YOUR_PRIVATE_KEY"],
gas: 2100000,
gasPrice: 8000000000,
saveDeployments: true,
}
This works like a charm. Hope this helped in saving some of your time.
Upvotes: 3