【问题标题】:Ethereum transaction was not mined within 750 seconds以太坊交易在 750 秒内未被挖掘
【发布时间】:2022-01-05 11:25:42
【问题描述】:

我正在尝试使用 React、solidity、truffle 和 web3 构建 DApp。 我创建了一个选民智能合约文件,并将其成功部署到 rinkeby 测试网络。 我正在尝试通过将交易从管理员帐户(我创建的 Rinkeby 帐户持有 0.5 testEth)发送到部署在 rinkeby 测试网络中的投票智能合约来从 UI 注册选民。 事务工作正常,直到 web3 js 的 sendSignedTranscation 的 transcationHash 函数,但 onConfirmation 回调不起作用。我收到这样的错误:

错误:交易未在 750 秒内挖掘,请确保您的交易已正确发送。请注意,它可能仍被开采! 在 Object.TransactionError (D:\server\node_modules\web3-core-helpers\lib\errors.js:87:21) 在 D:\server\node_modules\web3-core-method\lib\index.js:418:49 在 runMicrotasks () 在 processTicksAndRejections (node:internal/process/task_queues:96:5) { 收据:未定义

registerVoter 方法的代码:

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'
        );

【问题讨论】:

  • 如果您使用公共以太坊网络之一,您需要在 etherscan 中查看您的交易状态

标签: ethereum solidity web3js truffle metamask


【解决方案1】:

Transaction waiting delay is configurable in web3.js.

研究以太坊交易定价并相应地设置您的交易汽油费和等待期。

【讨论】:

    猜你喜欢
    • 2020-03-15
    • 2021-03-27
    • 1970-01-01
    • 2019-02-21
    • 2021-10-02
    • 2019-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多