By default hardhat provides 20 signer accounts for testing.
Is it possible to create random wallet on-the-fly and then connect it to hardhat network for testing?
So far, I try this code.
const provider = new ethers.JsonRpcProvider("http://127.0.0.1:8545");
const wallet = ethers.Wallet.createRandom().connect(provider);
console.log((await ethers.getSigners()).length);
I expect this should return 21, but it still returns 20 accounts.
Can anyone point out where do i go wrong?
Any help is appreciated, thanks.
New contributor
Kaito is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.