Mist: web3.eth.getAccounts does not work

Created on 6 Sep 2017  路  7Comments  路  Source: ethereum/mist

  • [x] I've asked for help in the Mist Gitter before filing this issue.
Version: `0.9.0`

I'm trying to get accounts async:

web3.eth.getAccounts(function(error, result) {
    if(error != null)
        console.log("Couldn't get accounts');
   console.log(result[0])
});

I'm getting the next error in the console:

app.js:5178 Uncaught TypeError: bytes.substr is not a function
SolidityType.decode @ app.js:5178(anonymous function) @ app.js:17889SolidityCoder.decodeParams @ app.js:17888SolidityFunction.unpackOutput @ app.js:41043(anonymous function) @ app.js:41071(anonymous function) @ app.js:7099(anonymous function) @ app.js:42371(anonymous function) @ VM92:665

UPDATE:
Okay, acutally the problem was from

web3.version.getNetwork(function (error, network) {
});

But now when I'm trying to call

web3.eth.getAccounts(function(error, result) {
    if(error != null)
        console.log("Couldn't get accounts');
   console.log(result[0])
});

I get as a result something like:
console: 1
Or for result[1]
console: 5

I expected to get an account address..

Web3 Please confirm Triage v0.9.0

Most helpful comment

 console.log("Couldn't get accounts');

You are opening it with a double quotes and closing it with a single quotes. 馃槈

Tested this and it works:

web3.eth.getAccounts(function(err, res){ console.log(res); });

All 7 comments

I have the same problem

getAccounts still doesn't return accounts in 0.9.3

It seems I needed to use "connect accounts" button appearing when I hover browser's favicon in the left pannel of Mist browser window.
At least, that works with web3.js 1.0.0-beta28.

 console.log("Couldn't get accounts');

You are opening it with a double quotes and closing it with a single quotes. 馃槈

Tested this and it works:

web3.eth.getAccounts(function(err, res){ console.log(res); });

@alexvandesande Can you please tell the version of web3 you're using? I'm trying to access my rinkeby accounts with the help of infura, but still end up getting empty array ( [] ).

This still appears to be an issue in 0.10.0:

screen shot 2018-03-21 at 6 15 32 pm

I think this issue ought to be reopened.

Edit: As @Pipeliner mentioned, you have to use the "connect" button in the top right of the window...I guess I don't know how to use this browser properly.

I connected it, but still []

Was this page helpful?
0 / 5 - 0 ratings