我用"web3.eth.getTransaction(address)"
做交易。
之后,它没有处理错误
“节点错误:{”code“: - 32000,”message“:”nonce too low“}”
检查nonce值后,它总是返回0。
我用
这是我的代码。
web3.eth.getTransactionCount(senderAddr, 'pending').then(function(count) {
count += 1;
var transactionObject = {
nonce: web3.utils.toHex(count.toString(16)),
from: sender,
to: receiver,
gasPrice: web3.utils.toHex(15000),
value: web3.utils.toHex(web3.utils.toBN(web3.utils.toWei(amount.toString(), 'ether'))),
data: '',
chainId: 3
}
}
我该如何解决?
请帮帮我......谢谢
也许你连接的节点给你一个错误的nonce
。
仅供参考,请务必删除count += 1;
专线。因为nonce
是0-indexed