Skip to content

Instantly share code, notes, and snippets.

@ianmonkuk ianmonkuk/simpleTest.html
Last active Feb 16, 2017

What would you like to do?
<script type="text/javascript" src="bower_components/web3/dist/web3.min.js"></script>
<script type="text/javascript">
function testETH(){
var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider("http://localhost:8545"));
var account = web3.eth.accounts[ 1 ];
var balance = web3.eth.getBalance(account);
console.log('account: ' + account);
console.log('balance: ' + balance);
document.getElementById('account').innerText = account;
document.getElementById('balance').innerText = balance;
<body onload="testETH()">
<h1>My first Ethereum Webpage</h1>
Account:<div id="account"></div>
Balance:<div id="balance"></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.