简体   繁体   中英

How to create and use 1k wallet signers on hardhat to test smart contracts?

I am gonna write smart contracts test on hardhat. By default, hardhat provides 20 signers with enough amount of ETH on it. But for my contracts, I will need 1000 signers and each signer should have some eth on it. How can I achieve this? I can create any amount of random wallets using ethers but am not sure how to send ether and use that random wallet.

In hardhat.config.js[ts], you could config accounts. Like this:

module.exports = {
 ...
 networks: {
   hardhat: {
      accounts: [
         privateKey0, 
         privateKey1, 
         privateKey2, 
         ...
      ]
   }
 }
 ...
}

how to send ether: https://ethereum.org/en/developers/tutorials/send-token-etherjs/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM