首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Web3.js sendSignedTransaction给出“错误:未能检查事务收据”

Web3.js sendSignedTransaction给出“错误:未能检查事务收据”
EN

Stack Overflow用户
提问于 2018-07-18 20:58:34
回答 1查看 1.9K关注 0票数 1

我使用Geth/v1.8.13-unstable-2e0391ea/linux-amd64/go1.10.3 v1.0.0-beta.34向循环中的geth节点web3js发送已签名的事务。

问题:在循环的初始迭代中,Node.js将事务哈希输出到控制台。但是,当循环运行超过几秒钟时,我们就开始得到错误:

错误:未能检查事务收据:{} at (/Users/x/test/node_modules/web3-utils/src/index.js:56:17) at /Users/x/test/node_modules/web3-core-method/src/index.js:260:23 at /Users/x/test/node_modules/web3-core-method/src/index.js:260:23 at

造成这个问题的原因是什么?

test.js

代码语言:javascript
复制
for (var i = nonce; i < nonce + 1000; i++) {
    nounce = web3.utils.numberToHex(nonce)
    receivingAddr = getRandomWalletAddress()
    var rawTx = {
        nonce: i, 
        gasPrice: gasPriceHex,
        gasLimit: gasLimitHex,
        to: receivingAddr,
        value: txValue,
        data: txData 
    }

    var tx = new Tx(rawTx);
    tx.sign(key);
    var serializedTx = tx.serialize();

    web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex'))
        .on('receipt', (receipt) => {
            console.log(receipt.transactionHash)
        })
}
EN

回答 1

Stack Overflow用户

发布于 2018-07-20 09:05:57

这是因为web3.js无法获得事务收据,您可以在这里看到代码:https://github.com/ethereum/web3.js/blob/1.0/packages/web3-core-method/src/index.js#L261

您可以通过调用eth.getTransactionReceipt来简单地再现错误并查找所发生的事情。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51410883

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档