使用web3从ABI构建合同:
contract = new web3.eth.Contract(JSON.parse(abi), '0x17c91A5a6f5e3E4BEaFC478D18C4A44D88833277', { from: '0x0Ad2b5CCe78D677fD000698a7E4Cde866DE189C6', gas: 100000})contract.methods.myFunction('constructorVariable1', 'constructorVariable2').send()
首先发送成功完成。Second+发送返回错误:nonce too low
我找不到任何关于使用send()方法手动增加nonce的文档。我也会认为不合格会自动增加吗?
我要补充的是,在这些发送过程中没有挂起的事务。
从truffle console断开和重新连接解决了这个问题。
发布于 2020-03-02 14:04:15
我看到了同样的nonce too low消息。我的问题在于添加了一个没有0x前缀的私钥钱包--简单地添加0x前缀就行了。这是我的工作代码:
let account = web3.eth.accounts.wallet.add("0x8f88c79e3.......");
TestContract.methods.testFunction().send({
from: account.address,
gas: '1000000',
value: 0,
});https://ethereum.stackexchange.com/questions/79970
复制相似问题