I'm trying to put together a simple application using Truffle, Metamask and ASP.NET.
I've created a bunch of test accounts in Metamask, I then start testrpc explicitly specifying a couple of those accounts and their initial balance, like so:
testrpc --account="0xa3........18, 1000000000000000000000" --account="0x80.......08, 1000000000000000000000"
In the testrpc log I can see these are started correctly:
Available Accounts
==================
(0) 0x27.....d5
(1) 0x1b.....24
I then deploy my contract, log in to Metamask and then spin up my web application.
In my js I can see that it's retrieving the web3 instance from metamask:
if (typeof web3 !== 'undefined') { // This evaluates to true
App.web3Provider = web3.currentProvider;
web3 = new Web3(web3.currentProvider);
console.log("Already have a web3 instance");
} else {
I try to get the list of accounts like this:
App.contracts.JmTest.deployed().then(function(instance) {
web3.eth.getAccounts(function (error, accounts) {
if (error) {
console.log(error);
}
console.dir(accounts);
However it only shows one of the two accounts that I started testrpc with...
Array(1)
0: "0x27.....d5"
It turns out that this is the currently selected account in Metamask. If I start testrpc without specifying any accounts and restart Chrome, the same thing happens - again I only get the the currently selected account in Metamask.
What am I missing?