Skip to content

Instantly share code, notes, and snippets.

@saurfang
Created April 14, 2018 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saurfang/648d9b5d8f06591ce151e0ac475da166 to your computer and use it in GitHub Desktop.
Save saurfang/648d9b5d8f06591ce151e0ac475da166 to your computer and use it in GitHub Desktop.
// get accounts managed by Metamask
var account;
web3.eth.getAccounts((err, acc) => {account = acc[0]});
console.log(account);
// get balance
web3.eth.getBalance(account, (err, balance) => {
console.log(web3.fromWei(web3.toDecimal(balance), 'ether'))
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment