How do I get the addresses from the Ganache?

Viewed 22

I am trying to implement a virtual Smart Voting in Remix IDE.

I want to get the remaining 99 addresses from the Ganache to create an iteration and have them register at polling stations and then vote.

How do I get these addresses?

photo from Ganache

1 Answers

Just to add to Martijn, you can also use ganache-cli package and specifiy the number of accounts you want!!!

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);
const accounts = web3.getAccounts();

you can use following docs to install ganache-cli -> https://www.npmjs.com/package//ganache-cli

Related