2017-08-09 85 views
17

我最近嘗試用松露和遵循下面的教程: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

從我的理解,似乎它無法找到以前的事務來散列新的事務?

回答

21

嘗試重新連接到您的網絡TestRPC在MetaMask:

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

我在以後這個問題絆倒停止並啓動一個新的TestRPC節點。

+0

對我來說完全一樣。我也重新啓動了TestRPC。 – matrix

+0

這並不總是爲我工作,但當我這樣做+重置帳戶它總是工作。 –

15

使用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