2

web3.eth.filter({ fromBlock:1, toBlock: "latest" }).get() is not working on my geth console. I downgraded my geth from 1.5.9 to 1.3.5 to resolve this but it's still not working.
Strange thing is that it is working on one machine with geth 1.3.5 but not on a cloud VM with same geth version.
web3.eth.filter({ fromBlock:1, toBlock: "latest" }).get() return [] while my blockchain has transactions in the blocks.How to resolve this.

Later I found out that this is not working on the Linux OS. Any help will be appreciated.

1

Add a {}, before { fromBlock. See https://github.com/bokkypoobah/TokenTrader/blob/master/testing/test_20170205_1849/06_checkEvents.sh#L118 for an example.



Update Responding To Comment

The following filter retrieves the logs from the Golem Network Token (GNT) contract:

var gntAddress="0xa74476443119A942dE498590Fe1f2454d7D4aC0d";
var filter=web3.eth.filter({fromBlock: 3492700, toBlock: 3492900, address: [gntAddress], topics: []});
filter.get(function(error, log) {
  console.log(JSON.stringify(log));
});
filter.stopWatching();

With the results (formatted) including:

[
  {"address":"0xa74476443119a942de498590fe1f2454d7d4ac0d","blockHash":"0x04b0e2a5460d67f293253d63fb4884d0d7e4a06c2774a845274b15b5cbdd68cd","blockNumber":3492715,"data":"0x0000000000000000000000000000000000000000000014152deb07b399d48000","logIndex":0,"removed":false,"topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000b611b7ca579cac70aee370375aaca089a45ff8be","0x0000000000000000000000000f8fa1b75ccb1cd9a0a52594ba8299468400e8b1"],"transactionHash":"0x388430286ce1d3cba8c40f50cca5dc5d1292e332a0316a8edeef001d4007d380","transactionIndex":2},
  {"address":"0xa74476443119a942de498590fe1f2454d7d4ac0d","blockHash":"0x0a8cbd40aa2661f7522a95dbe8e32b0386bc8bd462b7fa3b43028a2a9e24411c","blockNumber":3492765,"data":"0x0000000000000000000000000000000000000000000000000dbd2fc137a30000","logIndex":0,"removed":false,"topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000536806df512d6cdde913cf95c9886f65b1d3462","0x000000000000000000000000396a0fa0abd2251a3676d65d2d03fcbb9c3075fd"],"transactionHash":"0x267e85a582504e034e95d879c13c423daf38daca7f3ccf4dfe5ca8b80cbac758","transactionIndex":1},
  {"address":"0xa74476443119a942de498590fe1f2454d7d4ac0d","blockHash":"0x2262a2564025aa4a4cc10af04846c12db6081ed36e222cec874da936f0e09f6a","blockNumber":3492807,"data":"0x000000000000000000000000000000000000000000000100803c9fee14a4b400","logIndex":1,"removed":false,"topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000000536806df512d6cdde913cf95c9886f65b1d3462","0x000000000000000000000000396a0fa0abd2251a3676d65d2d03fcbb9c3075fd"],"transactionHash":"0x5a2a7884c2503b62dbed94cdab1d019b58034ea5e75cd64fd888a87a328590bb","transactionIndex":11},
  {"address":"0xa74476443119a942de498590fe1f2454d7d4ac0d","blockHash":"0x32cef6508d6a955f45ba8375fb951ea8371b2394c42d9a3691da84c02d2413b7","blockNumber":3492827,"data":"0x0000000000000000000000000000000000000000000000a49105c21659ba0000","logIndex":1,"removed":false,"topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000d94c9ff168dc6aebf9b6cc86deff54f3fb0afc33","0x0000000000000000000000008741ee12d356e284512ef4ecaf7e94b6d3ae613d"],"transactionHash":"0xdcaf377c1722c26b5ad508b179fb97d139c6cfb420bb5d9af177af420013083b","transactionIndex":19},
  {"address":"0xa74476443119a942de498590fe1f2454d7d4ac0d","blockHash":"0xde7849ab8a8ca60f7a9f6783d14f2e9878fa151d4d38695fbddfef959447b106","blockNumber":3492838,"data":"0x0000000000000000000000000000000000000000000000a49105c21659ba0000","logIndex":0,"removed":false,"topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000008741ee12d356e284512ef4ecaf7e94b6d3ae613d","0x0000000000000000000000000536806df512d6cdde913cf95c9886f65b1d3462"],"transactionHash":"0x5773342d096e55be3b32db817f9b5d4f4cda9268f99daf8e53a05c9742813a10","transactionIndex":7},
  {"address":"0xa74476443119a942de498590fe1f2454d7d4ac0d","blockHash":"0x6a402d755faab1f5b33955bb5813a66f42f8a14b4f76176f000a1438c34992cb","blockNumber":3492851,"data":"0x0000000000000000000000000000000000000000000001ba077b5641a7280000","logIndex":71,"removed":false,"topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x000000000000000000000000b681b19bb1f7e9f3c2ae0edeab368c2afaa4e590","0x0000000000000000000000007d3c699eede108b815f56c49f0f38ff96faf8f3a"],"transactionHash":"0xa2e83637c59baaf52c8f8cafaca3ed1c34264de9a77c13db99a30c40eadfb182","transactionIndex":84},
  {"address":"0xa74476443119a942de498590fe1f2454d7d4ac0d","blockHash":"0xddf3729cee73969b973128ba4a9fc4b7ba5afc68af21357bb15e201d16777647","blockNumber":3492862,"data":"0x0000000000000000000000000000000000000000000001ba077b5641a7280000","logIndex":2,"removed":false,"topics":["0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef","0x0000000000000000000000007d3c699eede108b815f56c49f0f38ff96faf8f3a","0x0000000000000000000000000536806df512d6cdde913cf95c9886f65b1d3462"],"transactionHash":"0xf35e6608a40caa0e1978e76bedf38291fe22718db4cebdabeae883309171c7ad","transactionIndex":10}
]
  • I tried , it is still not working – Aniket Apr 7 '17 at 8:09
  • See the updated answer – The Officious BokkyPooBah Apr 7 '17 at 13:38
  • will it work for general account address not on contract one? – Aniket Apr 8 '17 at 7:05
  • No. It won't work on Externally Owned Accounts. For contract accounts, it will only produce output for events that the contracts specifically log. See ethereum.stackexchange.com/questions/2531/… for some scripts that will help you find your transactions. – The Officious BokkyPooBah Apr 8 '17 at 7:27
  • I found out that eth.filter is not working fine on ubuntu os. @BokkyPooBah those scripts are not i am looking for. I want to get all the transactions of a blockchain – Aniket Apr 21 '17 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.