'hardhat configuration for multiple accounts in testnet
How to add multiple accounts here for rinkeby testnet
networks: {
rinkeby: {
url: process.env.RINKEBY_URL || "",
accounts: process.env.RINKEBY_PRIVATE_KEY_0 !== undefined ? [process.env.RINKEBY_PRIVATE_KEY_0 ]:[],
},
},
I tried
accounts : [process.env.RINKEBY_PRIVATE_KEY_0, process.env.RINKEBY_PRIVATE_KEY_1]
But it gives error.
Type 'undefined' is not assignable to type 'string'.
Solution 1:[1]
Error appeave due to process.env.RINKEBY_PRIVATE_KEY_0 (or process.env.RINKEBY_PRIVATE_KEY_1) can be undefined, but in accounts list must be only string type variables. You have to write:
accounts : [
process.env.RINKEBY_PRIVATE_KEY_0 as string,
process.env.RINKEBY_PRIVATE_KEY_1 as string
]
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 | Tyler2P |
