jai sai Kiran
jai sai Kiran

Reputation: 51

Ethereum transaction was not mined within 750 seconds

I'm trying to build a DApp using React, solidity, truffle and web3. I created a voter smart contract file and deployed it to rinkeby test network successfully. I'm trying to register a voter from UI by sending the transaction from admin account (Rinkeby account which I created holds 0.5 testEth) to Vote smartcontract deployed in rinkeby test network. The transaction is working fine till transcationHash function of the sendSignedTranscation of web3 js, but onConfirmation callback is not working. I'm getting error like this:

Error: Transaction was not mined within 750 seconds, please make sure your transaction was properly sent. Be aware that it might still be mined! at Object.TransactionError (D:\server\node_modules\web3-core-helpers\lib\errors.js:87:21) at D:\server\node_modules\web3-core-method\lib\index.js:418:49 at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) { receipt: undefined

Code for registerVoter method:

return await web3.eth
  .sendSignedTransaction(signedTx)
  .on('transactionHash', (txHash) => {
    console.log(txHash);
  })
  .on('confirmation', async (confirmationNumber, receipt) => {
    confirmNum++;
    if (confirmNum === 2) {
      if (!receipt.status) {
        res.status(400).send({ error: 'Transaction failed' });
      } else {
        const cipher = crypto.createCipher(
          'aes-128-cbc',
          process.env.ENCRYPTED_KEY
        );
        let ciphertext = cipher.update(
          account.privateKey,
          'utf8',
          'base64'
        );

Upvotes: 0

Views: 1574

Answers (1)

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83666

Transaction waiting delay is configurable in web3.js.

Study Ethereum transaction pricing and set your transaction gas fees and waiting periods accordingly.

Upvotes: 0

Related Questions