2

So I've updated my framework and with it the web3,js lib. When I run the console and attempt to get an account from my test network by web3.eth.accounts, it won't display a list of the accounts like before and instead shows the interface to some methods and objects, and none of them seem to be what I'm looking for. Also web3.eth.coinbase returns me undefined.

Yes, the provider is set correctly (I can even interact with my deployed contracts) and it has those generated accounts. So what might be wrong?

Web3.js 1.0.0-beta.37

Ganache CLI v6.1.8 (ganache-core: 2.2.1)

Truffle v5.0.1 (core: 5.0.1)

Solidity v0.5.0 (solc-js)

Node v8.15.0

  • We need some more code. What do you do? Through what peer do you access the network? Your own peer? A provider? – Andromelus Jan 8 at 18:33
  • are you connected with TestRpc, Ropsen or Private net? Need for information. – Amit Modi Jan 8 at 18:41
1

From your post, it's unclear which version of Web3.js you're using. That might make it difficult to resolve.

The thing that jumps out at me is I think you should be using web3.eth.getAccounts() which returns a callback. So, something like ...

var accountList;
web3.eth.getAccounts(function(error,response) { 
  accountList = response; 
  console.log(accountList);
});

Hope it helps.

  • 1
    That actually works, thanks. I'll update the post with some infos so you might be able to tell what's going on if you feel like it, but maybe trying to catch some informations without a promise calling is depreciated like coinbase, which was an object from eth previously. – Tadeu Moreira Jan 8 at 20:28

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.