Skip to content

Instantly share code, notes, and snippets.

@avtehnik
Created January 30, 2019 17:25
Show Gist options
  • Save avtehnik/10a88d891e840ba8168fcdba74339826 to your computer and use it in GitHub Desktop.
Save avtehnik/10a88d891e840ba8168fcdba74339826 to your computer and use it in GitHub Desktop.
Web3 simple example
var Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:7545"));
var balance = 0;
web3.eth.getBalance('0xfb71B55C0C526638e1d6b3DA7598a1b3785d30f8', function(err, wei) {
balance = web3.utils.fromWei(wei, 'ether')
console.log(balance);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment