Testrpc:在TX没有正确的随机数

Testrpc:在TX没有正确的随机数

问题描述:

我最近尝试用松露和遵循下面的教程:http://truffleframework.com/tutorials/pet-shopTestrpc:在TX没有正确的随机数

每当我尝试建立一个交易我不断收到以下

Error: Error: the tx doesn't have the correct nonce. account has nonce of: 14 tx has nonce of: 0

同样的错误

在线检查并阅读了很多与此相关的文章,但到目前为止还没有找到可能导致此问题的原因。

  • 松露v3.4.7
  • 密实度v0.4.13
  • NPM V5.3.0
  • TestRPC V4.0.1
  • Metamask v3.9.5

从我的理解,似乎它无法找到以前的事务来散列新的事务?

尝试重新连接到您的网络TestRPC在MetaMask:

  1. 选择Main Ethereum Network(或除localhost 8545任何其他)
  2. 选择Localhost 8545再次

我在以后这个问题绊倒停止并启动一个新的TestRPC节点。

+0

对我来说完全一样。我也重新启动了TestRPC。 – matrix

+0

这并不总是为我工作,但当我这样做+重置帐户它总是工作。 –

使用MetaMask v3.14.1您可以将您的帐号重新设置如下:

Resetting an Account In the Settings menu, MetaMask has a "Reset Account" button. This button wipes the current account's transaction history, which is used to calculate the current account nonce. enter image description here

Normal users should never have a reason to use this feature.

This is useful for developers who reset a test network but want to continue using the same account, forcing MetaMask to believe this network ID is a clean network in a fresh state.

编号:http://metamask.helpscoutdocs.com/article/36-resetting-an-account

(感谢Tim Wu


老回应: yatskevich的答案是正确的。

但是,对于人们如何使用松露4+和“松露开发”,你需要删除并重新安装MetaMask才能让它再次运行,每次运行松露开发!

这个问题在此解决: https://github.com/trufflesuite/truffle/issues/681,在这里: https://github.com/trufflesuite/ganache/issues/112,和这里:https://github.com/MetaMask/metamask-extension/issues/1999

在他们是在它和你需要每次重新安装MetaMask平均工作时间短!

+1

即将解决metamask问题https://github.com/MetaMask/metamask-extension/issues/1999#issuecomment-347615959松露正在等待他们的修复https://github.com/trufflesuite/trufflesuite.com/issues/30#issuecomment-348573629 – jopasserat

+1

请注意,您也可以简单地禁用然后重新启用metamask。仍然很痛苦,但不像重新安装那么糟糕。我还为松露开发做了一个补丁,它可以是一个短期修复:https:// github。com/MetaMask/metamask-extension/issues/1999#issuecomment-354141687 –

+1

@StanJames请注意,使用此修复会导致事件触发,由于某些原因事件在更改network_id后未触发。 – Random