3

I have encountered a problem where I need a large number of test accounts. How can I increase the number of test accounts from 10. Remix and ganache only give 10 accounts. I require more than that.

2 Answers 2

6

Ganache and Ganache CLI


With ganache-cli you can do this with the --accounts flag. For example:

ganache-cli --accounts=100

Ganache (the desktop application) comes with 100 accounts by default.

Remix


If you are using the Javascript VM, then you simply need to click the + button next to the word "Account"

account add

If you are using Injected Web3, then whatever is injecting your Web3 (most likely MetaMask) needs to have all those accounts. You must create more accounts there.

Finally, if you are using a Web3 provider, you must make sure that the provider you are pointing it to (probably ganache) has the accounts available. In order to do this, follow the "Ganache and Ganache CLI" section above.

0
1

Just to add into Shane's answer, if you are testing with ganache-cli, you can also do this:

const ganache = require('ganache-cli');
const Web3 =  require('web3');
const options = { a: 100 }; // NO OF ACCOUNTS
const provider = ganache.provider(options);
const web3 = new Web3(provider);

I hope that helps.

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.