3
console.log(transacting...);
web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', receipt => {
    log(receipt);
    log(`https://ropsten.etherscan.io/tx/${receipt.transactionHash}`.cyan);
    console.log("transaction done");
    return receipt.transactionHash;
});

I am using "web3": "^1.0.0-beta.35". The provider (INFURA) is so configured:

const ropsten = `wss://ropsten.infura.io/ws/v3${process.env.INFURA_ACCESS_TOKEN}`;
const web3 = new Web3(new Web3.providers.WebsocketProvider(ropsten));

The transaction works. I can see on Ropsten Etherscan that actually is performed and accepted.

The problem is that the on('receipt') event is not captured in time. Indeed, to be more precise, only a couple of times (without ever changing the code) worked. Once even after 12 minutes the on has "woken up" and the code continued without problems.

Note that the transaction took no more than 12 minutes to register on blockchain. From the moment the transaction starts, in about a minute I can see it completely executed on Etherscan, but in my NodeJS application the on event comes after 12 minutes of delay or even a lot more and it's not good. What can I do?

  • 1
    I'm seeing some strange results here also. I have a handler for the .on('receipt') event. but only the first line of the handler function, and its fires as if its the confirmation event, over and over.. :( – Barrard Mar 11 at 0:37

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.