I am trying to connect to Kovan testnet from a Node.js server. I have tried to connect in order to retrieve past events.
Steps tried so far:-
The connection was done via Infura. Tried these steps over multiple versions
Version 0.20.3(Version in Github):
var MyContract = web3.eth.contract(JSON);
contractAddress=<contractAddress>;
var contractInstance = MyContract.at(contractAddress);
var events = contractInstance.allEvents({fromBlock: 5000000, toBlock: 'latest'});
events.get(function(error, logs){
console.log(logs);
});
Despite having events no output are produced. If Infura is the issue is there any other way I can get events from Kovan Testnet?
I tried web3-1.0.0.beta19 to connect to Infura via websockets but realised there are no websockets for Kovan.
Best Answer
I found a work around by using the zero client provider. It works in a stable manner for the Mainnet and Kovan RPC connections provided by Infura.