I'm using Ganache to generate dummy accounts but every time I try to access the list of accounts using web3.eth.accounts or the web3.eth.getAccounts method, I only get access to the first account in the array. Can anyone advise on how I can get an array of all the accounts?
[Ethereum] Fetching all the accounts from Genache
testrpcweb3js
Best Answer
For version 0.x of web3:
try this:
or can simply try this :
for version 1.x of web3:
version 1.0.0 of web3 uses promises while 0.x doesn't work on promises it works on callbacks.
hope it helps!