Shirish Singh
Shirish Singh

Reputation: 857

HardHat and Rinkeby ProviderError: Must be authenticated Error

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

Answers (3)

DereK
DereK

Reputation: 107

There is some issue with your provider URL, try it without env first. it will work

Upvotes: 0

Patrick Niyogitare
Patrick Niyogitare

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

Shirish Singh
Shirish Singh

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

Related Questions