Last active
February 16, 2017 12:20
-
-
Save ianmonkuk/cf0edddbf83a33d926a422f5cb0c38d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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