1

I have set up a remote geth node on AWS as a web3 provider for my DApp.

The geth node is initialized with the following command (for testnet) as a daemon service:

[Unit]
Description=Ethereum go client

[Service]
ExecStart=/usr/bin/geth --testnet --port 30311 --rpc --rpcport 8549 --rpcaddr 0.0.0.0 --rpccorsdomain "*" --rpcapi "eth,web3,net" --lightserv 25 --lightpeers 50

[Install]
WantedBy=default.target

I then fetch events with the following command, where fromBlock = contract creation block:

const getPastEvents = async (event, fromBlock, callback) => {
  const pastEvents = await event({}, { fromBlock, toBlock: 'latest' }).get();
  callback(pastEvents);
};

If I use the remote geth node as the web3 provider, it fetches the most recent of that event (e.g. LogEvent), but it doesn't fetch the whole history of events.

If I use a local geth node, it fetches all of the events.

I also tried a third party remote node, whose documentation said it was configured the same way, using the same geth command as I have above. And that one manages to fetch all events also.

Let me know if anyone has any ideas on why my node set up is not retrieving the full events history. Thanks.

0

The problem was that my geth node was failing to completely sync. web3.eth.getSyncing(console.log) should log false to denote that syncing is successful.

After I confirmed my node was fully synced, events retrieval worked.

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.