0
    const event = contractInst.Transfer({},{fromBlock: 0, toBlock: 'latest'});

    events.get(function (error, result) { 
        if (!error) {
            console.log(result);
        }
    });

The get callback is called immidiately and always returns an empty array.

I synced rinkeby on my local machine (fast mode):

> eth.syncing 
{
  currentBlock: 2695904,
  highestBlock: 2695974,
  knownStates: 5468913,
  pulledStates: 5466381,
  startingBlock: 1062319
}

All the transfer events are shown on etherscan:

https://rinkeby.etherscan.io/address/0xf736de997449df5cd756c34858747786e98bcd3d#events

EDIT:

It works if I use an external node (like using metamask to fetch web3). I'm using Geth to sync my node with the following command:

geth --rinkeby --syncmode=fast --rpc --rpcaddr "0.0.0.0" --rpccorsdomain "*" --rpcapi db,eth,net,web3,personal

To connect the node I'm doing:

const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
  • 1
  • In fast mode until the sync has finished you cannot rely on the data being complete. – Ismael Jul 28 '18 at 2:58
  • I will try to find out if it is the same reason. When using an external node like new Web3(new Web3.providers.HttpProvider('https://rinkeby.infura.io:443')); the events should be listed right? – MarcS82 Jul 30 '18 at 6:45

Your Answer

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

Browse other questions tagged or ask your own question.