aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/ethtest/example/node-app.js
blob: f63fa9115ff439525848a38f54eca94b41076adb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env node

require('es6-promise').polyfill();

var web3 = require("../index.js");

web3.setProvider(new web3.providers.HttpRpcProvider('http://localhost:8080'));

web3.eth.coinbase.then(function(result){
  console.log(result);
  return web3.eth.balanceAt(result);
}).then(function(balance){
  console.log(web3.toDecimal(balance));
}).catch(function(err){
  console.log(err);
});