I have a node in ropsten network and created 3 accounts say a,b,c using geth. Connected metamask with ropsten network and created other account 'd' using metamask and imported accounts a,b and c by passing JSON file. But account 'd' was not shown with eth.accounts in geth console.
When I connected metmask with nodejs by :
var Web3 = require('web3');
window.addEventListener('load', function() {
window.web3 = new Web3(web3.currentProvider)
var ETH_CLIENT = window.web3
web3.eth.getAccounts(function(error, accounts) {
if (error) {
console.log(error);
}
console.log('account0 ='+accounts[0]);
console.log('account1 = '+accounts[1]);
});
})
accounts[0] shows account address of 'd'. accounts[1] is 'undefined'.
How to get imported accounts from metamask in nodejs?
And why account 'd' is not visible with command 'eth.accounts' in geth console? I have a running ropsten node at port 8545. But accounts 'a' ,'b' and'c' was not visible in metamask when I connected it. I had to import accounts..
Help will be appreciated :)