'H88 Error: Invalid account: #0 for network: mumbai - Expected string, received undefined
This is my hardhat.config.js file code
module.exports = {
solidity: "0.8.4",
networks: {
hardhat: {
chainId: 1337
},
mumbai: {
url: "https://rpc-mumbai.matic.today",
accounts: [process.env.pk]
},
// polygon: {
// url: "https://polygon-rpc.com/",
// accounts: [process.env.pk]
// }
}
};
When running npx hardhat test the following error appears:
**Error HH8: There's one or more errors in your config file:
- Invalid account: #0 for network: mumbai - Expected string, received undefined**
Seems I have a couple of errors with my hardhat.config.js file but can't locate. I am using Nader Dabit's full-stack-web3 tutorial for full stack web3 development.
Solution 1:[1]
Correct:
mumbai: {
url: "https://rpc-mumbai.matic.today",
accounts: process.env.pk
Incorrect:
mumbai: {
url: "https://rpc-mumbai.matic.today",
accounts: [process.env.pk] <-- remove the array
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Drew |
