I have a local blockchain where I have deployed a contract. I want to interact with it sending multiple responses at the same time. For this propose, I cannot use Metamask to confirm each transaction. I need to create my own wallet and send the tx signed. I have my own wallet with an account using ethers.js:

var password = "xxxx";
var json = JSON.stringify(data); //data = content of the keystore file of an account
ethers.Wallet.fromEncryptedWallet(json, password).then(function(wallet) {
    App.Wallet = wallet;
    App.Wallet.provider = new ethers.providers.JsonRpcProvider(`http://localhost:3002`, { chainId: 15 });

var account = App.Wallet.address;
let rawtx = {from: App.Wallet.address, to: App.contracts.MyContract.address, gasPrice: 18000000000, gasLimit: 20000000000, data: getdata }

var signedTransaction = App.Wallet.sign(rawtx);
var transaction = ethers.Wallet.parseTransaction(signedTransaction);
var sendTransactionPromise = App.Wallet.sendTransaction(transaction);
sendTransactionPromise.then(function(transactionHash) { console.log(transactionHash); });

It works, but just with one account. Is there any way to create a wallet with multiple accounts? or how could I send multiple transactions from different accounts with my own wallet?

I am trying just with a for, but it is a bit dirty and my browser is not responding correctly, each time that i call ethers.Wallet.fromEncryptedWallet for each account the program is broked. I am also trying with web3.eth.accounts.wallet but I always get the error "undefined" and I am using web3 1.0.

1 Answer 1


You should be able to have multiple wallets if you open different wallets.

One option to imporve performance is to create your own wallets from a mnemonic. Having to decrypt a wallet might make your browser to appear unresponsive.

Other option is to execute from Node in the command line. Node can access to native libraries accelerating some crypto operations.

  • Thanks for the ideas. Do you know where can I find an example how to use or good documentation about mnemonic? @Ismael Sep 11, 2018 at 7:20
  • The definition how to generate mnemonics is in BIP39. There's a package bip39 for npm that can be used to generate mnemonic phrases.
    – Ismael
    Sep 11, 2018 at 15:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.