I have the following code:
var filter = web3.eth.filter({
fromBlock:4076955,
toBlock:"latest",
address:"0x0123456789012345678901234567890123456789"
});
filter.get(function(error,logs){
if (!error) {
console.log("Found block " + logs.blockNumber);
console.log(JSON.stringify(logs,null,2));
}
}
and when I run the code, I get:
Found block undefined
[]
I would have expected to get a number for logs.blockNumber and an object as the return value (source: https://github.com/ethereum/wiki/wiki/JavaScript-API#watch-callback-return-value)
Question: Why might I not be getting the expected result?
toBlock: 'latest'totoBlock: 4076956I get the same result. – Webeng Jul 26 '17 at 16:45web3.eth.filter– Victor Baranov Jul 26 '17 at 17:05filter.watchwas for listening, whilefilter.getwas for getting from blocks. Here: https://ethereum.stackexchange.com/questions/21694/using-web3-eth-filter – Webeng Jul 26 '17 at 17:13