Metamask-extension: add (editable) nonce to confirm screen

Created on 10 May 2017  Â·  42Comments  Â·  Source: MetaMask/metamask-extension

Currently I can edit the gas limit and gas price on the confirm screen. The nonce is not being displayed. It would be very helpful to at least show the nonce for that transaction but even better would be to make that field editable. That would help in the following situations:

  • long pending transactions that I want to "overwrite" with another one that might e.g. have higher gas price
  • "oh shit I sent a wrong tx"-situations that might be quickly fixable by "overwriting" it with another transaction
  • testing what strategy miners actually use to sort transactions
L03-UI L23-devMode N00-needsDesign P2-sooner T01-enhancement T03-discussion

Most helpful comment

Either this or #2278 is now a very high priority, for the reasons you've described. Hopefully in the next couple weeks.

All 42 comments

I agree we need some method of letting users manage nonces. We may just need to make them more visible across the entire application, from the displays of individual accounts, to transactions.

I've even been thinking maybe clicking a tx should go to a tx detail view (instead of straight to etherscan), and we could show the nonce there, as well as maybe an "Edit" button that allows "Resubmit".

I'd like us to pass this through a little design time before we show it, since it's one field that can completely prevent a transaction from working, but I agree this is important to address.

What is the status on this? The recent spike demand made my 5 GWei transaction completely stuck and I was unaware of the traffic. It's been more than 12h and I would appreciate being able to overwrite the nonce without going through the hoops of importing my privatekey somewhere else.

Either this or #2278 is now a very high priority, for the reasons you've described. Hopefully in the next couple weeks.

please!!!

For development this is also a headache. I reset ganache and the nonce is now back to 0, but metamask sees the nonce as being 190 in my browser. I don't want to keep switching accounts.

Ah, I see that I can set the nonce in web3:
https://github.com/ethereum/wiki/wiki/JavaScript-API#parameters-25

That helps me for development :)

For the ganache issues, refer to #2373 and #1999.

I see that bounty worthy was added by @danfinlay. How would I go about this if I want to see if I can tackle it?

Sorry @adrianmcli this one isn't an ideal bounty anymore, because it involves designs that we haven't produced yet, right before we roll out the new UI, so effort on this would be likely to be wasted at the moment.

We should really document our UI/design process flow better as we add more bounties, I realize I keep using "design blocker" as a reason an issue isn't ideal for public contribution yet...

+1 that this is really necessary asap

@dmdque Could you describe your use case that makes this an asap feature for you?

I think _any_ time you need to override a nonce is an ASAP issue ... At least on mainnnet when eth is on the line, and you're racing against miners.

If I accidentally sent a bad transaction, I'd be able to cancel it before it gets mined, potentially saving a lot of trouble (and money).

Ok, that’s fair. We are also going to just add a “cancel” button that sends a higher gas tx with the same nonce, but we could add a setting to show this field (still hiding it from new users).

Hello,
is there any way to give a command in html/js which will insert a specific nonce?

Like:
......
web3.eth.sendTransaction({
to: user_address,
from: user_address,
value: web3.toWei('0.001', 'ether'),
nonce: 274,
.......

Thank you!

Yes. That will work.

On Mon, 27 Aug 2018, 15:31 Mecooo, notifications@github.com wrote:

Hello,
is there any way to give a command in html/js which will insert a specific
nonce?

Like:
......
web3.eth.sendTransaction({
to: user_address,
from: user_address,
value: web3.toWei('0.001', 'ether'),
nonce: 274,
.......

Thank you!

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/MetaMask/metamask-extension/issues/1410#issuecomment-416210919,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AC8oX_wQagPp3SVIOV2lAr2V-uWyOCMAks5uU-aygaJpZM4NXPLI
.

Well, it doesn’t work and I don’t even have an idea why :/

If you've sent the wrong nonce you should see that in the error message. I
don't think this is a metamask issue, but a web3 one. You should check
through their docs. Do things work when you don't add the nonce field?

Also, most of the time you don't want to be setting the nonce. If you need
to reset the metamask nonce, they have an option for that in the ui.

On Mon, 27 Aug 2018, 19:26 Mecooo, notifications@github.com wrote:

Well, it doesn’t work and I don’t even have an idea why :/

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/MetaMask/metamask-extension/issues/1410#issuecomment-416283769,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AC8oXx1szjGvvV-YJ-kTOvJMFrthC_rAks5uVB2ogaJpZM4NXPLI
.

The txn itself works. But with an other (the normally following) nonce. And not with the nonce that I gave .. like the 274 in my example. It just ignores this order
The aim is to set the same nonce as in one of my pending txns to cause a failure which will abort both txns. As I know this is atm the only way to cancel a pending txn.

In trust wallet it is no problem. There I can set my wished nonce. But in MetaMask isn’t a possibility that I’ve found so far.

Neither to cancel the txn nor to set a specific nonce

I mean, do you understand what my aim is? Do you guys have an other idea?

grafik

With that the txn is starting.. everything is working, but the nonce isn't. It is opening MetaMask with exactly the right txn like I set in the code.. But without the given nonce.

It is ignoring the line with the nonce.. And I have rly no idea why.

I would very appreciate your help! Thank you very much!

Hi @Mecooo:

No, MetaMask ignores dapp-provided nonces right now. Can you describe the reason you wanted to edit it?

Right now we manage nonces to account, to simplify a variety of possible problems.

Hi,
there were pending txns in one of my accounts. I sent the ETH to a smartcontract. After a huge gain in gasprices they stucked in the system. After a short while it was not longer worth it to send the ETH to the smart contract. Because of that I wanted to cancel the txn. But there is no way with MetaMask.

So it worked with trustwallet on my Smartphone. But I want to code something that makes it possible with the PC and MetaMask. I lost a huge amount of money before I had Trustwallet because of this issue, and some others lost theirs as well, cause they couldn't abort without trustwallet. This is the basic reason. I want to give my txn the same nonce as the pending txn that I wanna cancel. The failure would do the rest. As I said.. it worked perfectly on my phone with trustwallet.

MetaMask uses your currently pending transactions to calculate the correct nonce to give an additional transaction.

When submitting one in place of another pending transaction, the rest of your transactions are still in queue, and so letting users do that has resulted in some dangerous and confusing situations in the past:
https://consensys.zendesk.com/hc/en-us/articles/360004133232-Ghost-Accounts-Ether-Sending-Away-Whenever-Funding-An-Account

To address this problem in a safe way, we are currently implementing the ability to cancel your transactions (https://github.com/MetaMask/Design/issues/25, https://github.com/MetaMask/metamask-extension/issues/4022) in a way that actually keeps users safe from confusing situations like the one above.

One way to work around this is to just ignore the transactions that have been broadcast. You can do this in MetaMask today using the reset account feature, but you can also just send a transaction from any other client to get the same effect. In this scenario, you send a replacement transaction, and hope for the best. We don't make this easy by default right now, because we've seen it can result in users losing funds in other ways.

Sorry this bit you, but rest assured we are actively working on solving the problem you faced in a way that is even safer than switching between clients.

but you can also just send a transaction from any other client to get the same effect. In this scenario, you send a replacement transaction, and hope for the best.

You mean like TrustWallet, right? Would an other browser with MetaMask work as well?
For example:
I have these issues in firefox and can just install chrome and insert MetaMask there.. add my private key and launch a txn.. But how without chaning the nonce? Is it because the other client hasn't gotten the new (pending) txn number so far? And why is it possible in Trustwallet. I mean, there you can easily change the nonce.

Thank you for your answer :)

Hello again @danfinlay :)
Is it possible to code a external button on my website that will reset MetaMask with its txn list? Probably not, but thought it is worth asking it.

Thank you,
greetings Meco

You mean like TrustWallet, right? Would an other browser with MetaMask work as well?

Yes, any other client, including another browser with MetaMask would work in this scenario.

Is it possible to code a external button on my website that will reset MetaMask with its txn list?

No.

I have these issues in firefox and can just install chrome and insert MetaMask there.. add my private key and launch a txn.. But how without chaning the nonce? Is it because the other client hasn't gotten the new (pending) txn number so far? And why is it possible in Trustwallet. I mean, there you can easily change the nonce.

We could very easily let you change the nonce, and we will probably add this under a flag in settings, but by default, we see far more users lose funds and get frustrated by editing their nonces without knowing what they're doing than we get people who want to edit their nonce.

Well, that is absolutely true!

Of course there are more people using MetaMask who are not familiar with this option and would probably use it in a wrong way. Provided that it is obvious like changing gas and so on.

What would you say if you -for the time being- add the possibility to edit it only with some external "tools". So the function is limited to these tools and people have to search for it. So there would be no one who would do it by mistake, because there wouldn't be a direct possibility in the MetaMask interface. And on the other hand you would offer the possibility for those who wanna use it. So those users would do it consciously.. most likely with the knowledge which is important for them.

Win-win in my opinion with a very minimum of risk.

It's an interesting idea, but why not just add an advanced flag to allow editing it in settings? I think this solves the problem just as well without needing to figure out how to expose this new semi-restricted API to an approved tools list.

Plus, our new safer cancel feature should make it very user-friendly for even novices to achieve what you're going for, without needing to know about nonces.

To be honest.. I thought about this idea as well. But without the cancel feature the user would still have to know how it exactly works and how he has to set the nonce and where to find it on etherscan for example. Sometimes people just think they know it 😉 and probably it would make it harder for external devs to work with it, if something would be hidden in the settings which a user would have to enable before he can use the dapp.

On my website is everything the have to know and it is very easy to understand.

Isn’t it easy just to let MetaMask take the dapp provided nonce with
...
nonce: 123,
}
Cause you said atm it just ignores it. So just don't ignore it :)

With the cancel feature you are right. After this release there wouldn’t be a reason or benefit for my idea.

Is anyone working on this? Wouldn't this be helpful in the following scenario?

  1. Send an ETH transaction, with low gas, gets stuck (with nonce a)
  2. Realize it takes too long, send a cancellation tx, with a higher gas, also with nonce a.
  3. Cancellation tx also takes too long, even though you increased the gas amount. It seems that the "speed up" button only appears on the latest pending tx. So at this point, if I wanted to simply send the first ETH tx with a higher gas amount (rather than canceling), I'm not able to do that (since speed up button only appears on the latest pending tx, which is the cancel tx here). I have to submit a cancellation tx on the 1st ETH tx successfully before I can submit any more transactions.

@danfinlay I'd be happy to work on this feature, if there's any guidance.

Well I was working on my idea and already finished it. There is just no way as long as MetaMask ignores nonce of external dapps

@mehmeta that's a good point - we should probably persist the "speed up" button on all tx with the lowest nonce. Filed here: https://github.com/MetaMask/metamask-extension/issues/5732

Could really use this feature. Trying to place a bid. My transaction has been stuck for a long time. Tried again with higher gas, also stuck seemingly forever. At this point my bid is useless and i'd rather just submit a new bid over the same nonce but don't have that capability.

This feature would be useful because sure i can keep raising my gas, but in the time relevant situation, I will have to cancel my bid and place a new one which means paying three gas fees instead of one for a gas intensive transaction.

Can you add nonce to edit? This ticket is 2 years old. As it not often used, it would be possible to "hide" it in the settings, like "overwrite nonce for next tx" or so.

Can you add nonce to edit? This ticket is 2 years old. As it not often used, it would be possible to "hide" it in the settings, like "overwrite nonce for next tx" or so.

I think adding this as an advanced setting would be the appropriate way to do it. Would be a simple addition, but is probably not going to hit our primary priorities soon, making it a better candidate for a bounty. I would probably want to open a fresh issue specifying that exact feature cleanly, for the sake of easing a bounty hunter's cognitive load. Added as #6757 .

Btw, regarding cancelling transactions above: We have a "cancel" button on pending txs, so nullifying transactions safely is already possible. Try clicking a pending tx to try it!

Thanks for the new ticket, looking forward. I ended up using an old offline version of myetherwallet: I did a offline tx, where you have to set nonce anyway.

@danfinlay Cancel doesn't work. Metamask lost my transaction, says invalid after speeding up. Can still see old one pending on Etherscan. Need to change nonce manually now and cancel.

@danfinlay Honestly not even sure how to do it lol. I'm gonna have to import my private keys to offline MEW now because metamask is missing this feature?

chrome_ouoEuHoOJa

@doggodfroglog to help us diagnose that issue, you can download your "state logs" by following this guide, and then sending them to [email protected] .

This should fix this, hopefully merged soon: https://github.com/MetaMask/metamask-extension/pull/7089

Was this page helpful?
0 / 5 - 0 ratings