3

Hi I ran a simple voting example connecting to https://rinkeby.infura.io/ since I do not run local Eth node. Everything works fine except event watching.

var event2 = contractInstance.EventTester(); event2.watch(function(error, result){ if (!error){ console.log(result); }else {console.log(‘ERROR’)} });

When I submit a transaction I do not see that the event was fired (it is called in the contract function). Am I missing anything ?

1
  • you're doing something wrong because these work Oct 25, 2017 at 19:37

1 Answer 1

2

I have been having horrible problems catching events in Rinkeby test net using Metamask. I know things work because I can use Metamask though localhost (testrpc) and it works fine, but it is extremely intermittent with Metamask.

This seems to be a really common issue. I have solved it by instead logging the tx hash that is returned when you make a tx, and then calling web3.eth.getTransactionReceipt(txhash) until it returns not null, and parsing the events from there.

Hopefully this helps. Of course this isn’t viable in all situations.

1
  • This has been giving me a head ache! Glad to see it is a common problem
    – YulePale
    Sep 16, 2021 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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