web3.eth.watch('pending').changed not being called?

ThePiachuThePiachu Member Posts: 16
edited June 2015 in Education
I'm currently trying to follow the tutorial for writing javascript for AlethZero client. I'm trying to display live data in the JavaScript API window. I drag and drop my test.html into it, the function

web3.eth.watch('pending').changed(function(){

gets called and data is populated. I mine a few blocks, and nothing changes. My code looks like:



JavaScript API




///First web3.eth.watch code to monitor coinbase


///Insert your contract address var here:

///Second web3.eth.watch code to monitor block number
web3.eth.watch('pending').changed(function(){
var coinbase = web3.eth.coinbase;
document.getElementById('coinbase').innerText = coinbase;
var balance = web3.eth.balanceAt(coinbase);
document.getElementById('balance').innerText = balance;
var blockNumber = web3.eth.number;
document.getElementById('latestBlock').innerText = blockNumber;
var hash = web3.eth.block(blockNumber).hash;
document.getElementById('latestBlockHash').innerText = hash;
var timeStamp = web3.eth.block(blockNumber).timestamp;
document.getElementById('latestBlockTimestamp').innerText = Date(timeStamp);
var contractString = JSON.stringify(web3.eth.storageAt(contractAddress))
document.getElementById('contractString').innerText = contractString;
});








JavaScript API



Coinbase Address:
Balance:
Latest Block Number:
Latest Block Timestamp:
Latest Block Hash:
Contract String:
Favourite Python:


What am I doing wrong?
Post edited by StephanTual on

Comments

Sign In or Register to comment.