Skip to content

Instantly share code, notes, and snippets.

@ianmonkuk
Last active February 16, 2017 12:20
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 ianmonkuk/cf0edddbf83a33d926a422f5cb0c38d1 to your computer and use it in GitHub Desktop.
Save ianmonkuk/cf0edddbf83a33d926a422f5cb0c38d1 to your computer and use it in GitHub Desktop.
<html>
<head>
<script type="text/javascript" src="bower_components/web3/dist/web3.min.js"></script>
<script type="text/javascript">
function testETH(){
console.log('starting...');
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;
}
</script>
</head>
<body onload="testETH()">
<h1>My first Ethereum Webpage</h1>
Account:<div id="account"></div>
Balance:<div id="balance"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment