Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private blockchain (i.e. Truffle develop/Ganache) gets out of sync with MetaMask #4361

Closed
rhlsthrm opened this issue May 24, 2018 · 3 comments

Comments

@rhlsthrm
Copy link

I am developing a dapp and testing with Metamask. Often through my development process, my Metamask gets out of sync with the blockchain, resulting in nonce errors. The workaround is to uninstall and reinstall Metamask, then re-import accounts, which is very time-consuming.

My reproduction steps for the issue are as follows:

  • Connect Metamask to Custom RPC (http://localhost:9545 for truffle develop).
  • Create transactions with Metamask (transactions are working).
  • Re-migrate contracts by closing truffle develop console, reopening, and running migrate --reset (this preserves the contract deployment addresses).
  • Refresh the page.
  • Try to perform transactions. An error about nonce pops up.

I understand this is not behavior which will happen on a production blockchain, however, I rely on Metamask for development and it would be great to have a way to reset the account back to the initial state.

@danfinlay
Copy link
Contributor

This workaround was made for just this problem:
https://metamask.helpscoutdocs.com/article/36-resetting-an-account

A longer term solution will require special communication between MetaMask and Ganache, which we hope to do eventually, but is unfortunately lower priority at the moment.

@mallapurbharat
Copy link

mallapurbharat commented Jul 13, 2018

I'd like to reopen this issue, as I'm still seeing this issue (both on Chrome and Firefox) with the latest version (Metamask 4.8.0) on Ubuntu 16.04 . Ganache version is 1.2.0.

I've tried the following steps, but to no use.

  1. Resetting the account
  2. Switching networks and back again
  3. Reinstallation of Metamask multiple times.

Though related, the unique problem is that my nonce in my local Ganache network is 8, after deploying my contracts. However, Metamask is not picking up the network transaction activity and is still solidly at 0. Hence I'm getting a nonce error (Metamask nonce: 0, Tx nonce: 8). Please see attached snapshots.
Error details as below:


Error: Error: Error: Error: [ethjs-rpc] rpc error with payload {"id":1424189557055,"jsonrpc":"2.0","params":["0xf8ec088501dcd65000834c4b409426081ddc1956a6fa8ac0d624759bed658d01f87480b884946be2610000000000000000000000008f756250f09c8bc2113705e7e1ca0c8b9a332e0e0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000d57696c6c79204865726d616e6e00000000000000000000000000000000000000822d45a09dd75acb1d07c3786be9eec47ea3d5eba0fee22cf19ebbce559593d41fcee39ba073578003f07988b66db1b790e2a9702f36d8ed0c20bdabe9eba60f78a125a0c3"],"method":"eth_sendRawTransaction"} Error: the tx doesn't have the correct nonce. account has nonce of: 0 tx has nonce of: 8


Please let me know asap if I should open up a new issue or whether you will reopen this issue.
Snapshot of Ganache showing 8 transactions

ganache_8_transactions

Snapshot showing nonce error:
js_console_error

@bdresser bdresser reopened this Jul 13, 2018
@mallapurbharat
Copy link

mallapurbharat commented Jul 14, 2018

Ok... Did some troubleshooting. When I run Ganache 1.2.0 (and 1.2.1 which had some bug fixes), I faced this error of nonce mismatch when I try to do a transaction with Metamask.
However, Using Ganache 1.1.0, everything works fine. So I doubt this is a bug in Metamask, though it appears that way.

I will report this error on the Ganache issue list now.
Summary: Probably not a bug in Metamask. Resolved in my case by using older version of Ganache (1.1.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants