Nonce too low ошибка транзакции что это

To begin with, let us understand what does Nonce means – Nonce is the position in the sequence of transactions that is being executed by your wallet.

You might come across the issue of Nonce if you have multiple transactions pending (say, for example, your first transaction is still pending maybe because the gas fees were too low, then you try for a second transaction and now this is waiting too so that the first transaction is cleared).

If there are multiple transactions in sequence, Ethereum will always try to clear the transactions that were initiated first, before moving on to the next transaction.

This is done to ensure there are no malicious attacks on the network by initiating transactions in bulk. 

The ‘Nonce Too Low’ Issue is quite common while using MetaMask, here’s what it means and how to solve it. 

What Does It Mean By Nonce Too Low?

Nonce Too Low error occurs because of the nonce that is being used by the Metamask wallet at the time of transaction creation.

Nonce Too Low means that the used nonce is incorrect, and the Ethereum node in the network that is being communicated by your Metamask wallet indicates that there is a more recent transaction that is pending (that has a higher nonce). 

Some potential ways to solve it: 

  • Increase your nonce 
  • Wait for sometime and then try again 

How To Increase Your Nonce?

The Nonce value is usually hidden and needs to be set/adjusted manually.

Here’s how to do it on Metamask:

Step 1: Log in to your Metamask Account 

Step 2: Click on ‘Settings’.

On the top right corner of your account, click on your profile photo and choose ‘Settings’ from the drop-down menu. 

Step 3: Click on ‘Advanced’.

You will find a menu of options to the left, in the Settings tab.

Choose ‘Advanced’ in that. 

Step 4: Toggle ‘Customise Nonce’.

You will find this option by scrolling down a bit.

By default, the toggle is off. 

Step 5: Now when you initiate an Ethereum transaction with your MetaMask Wallet, at the time of the transaction, you can also find the option to set your nonce.

You can fill this out accordingly. 

Also Read: Fix: “Metamask Insufficient Funds” or “Confirm Button Gray Out” Error

What Does Nonce Mean On MetaMask?

It is one of the most important and less understood concepts of the Ethereum blockchain.

The Ethereum Yellow Paper defines it as the number of transactions (absolute number) sent from a particular Ethereum wallet address.

This nonce is not stored in any way on the blockchain but is just the value of the total transactions coming from a wallet. 

To understand the importance of nonce, first, know that Ethereum is essentially a network of nodes that is decentralized.

When you initiate a transaction with Metamask for example, it is sent to a temporary pool and stays there till the mining is done and is added to the respective block.

Suppose you send two back-to-back transactions from your Metamask wallet, without the Nonce number, the miner would not know which transaction was initiated first.

On the other hand, with Nonce, your first transaction would be Nonce 0, and the second would be Nonce 1 (assuming you never had any transactions initiated before this).

The miner would now know the order and would process the Nonce 0 transaction first, before moving onto the Nonce 1 transaction. 

As mentioned above, you can manually set the Nonce too, in other words, the order in the sequence of transactions to be executed. 

What Does A Nonce Of 0 Mean?

Every transaction on the Ethereum blockchain will have a Nonce value associated with it corresponding to the wallet the transaction is created from.

A Nonce of ‘0’ means it is the first transaction to be executed from a particular wallet.

Nonce values increment in the order of ‘1’ with every sequential transaction. 

What Does Nonce Too Low Mean In Metamask?

Consider a scenario where you already have transactions pending on Metamask with Nonce 0 and Nonce 1, and for some reason, they have not been executed yet.

While you initiate the third transaction, if you custom set the Nonce as ‘1’, you will come across this error – signifying that there is already a transaction pending with that Nonce number so you have to choose a higher nonce number to fix this error.

In this case, you need to set Nonce ‘2’ or above. 

Why Does “nonce Too Low” Error Occur In MetaMask?

The error occurs where there’s already a more recent transaction with the Nonce value that is being used.

Nonce’s too low error is to maintain the ‘Nonce’ stack on MetaMask which is in turn important to understand the order of transactions to be mined by the Ethereum miners, and also to prevent the flood of malicious attacks. 

How To Fix The “nonce Too Low” Error In MetaMask?

Fixing this error is a piece of cake!

Consider two cases

  • First, if the transaction is being initiated from a Web3 wallet such as MetaMask
  • Second, if the transaction is not coming from any Web3 Wallet. 

In the MetaMask, Go to Settings > Advanced > Reset Account.

This will reset the Nonce count associated with your wallet to 0 by clearing all previous transaction history stored in the cache of your browser.

The next transaction that you initiate will be Nonce 0 and will be executed first. 

In other cases – it is recommended to wait for a few minutes for the server to clear its own transaction load and try again. 

Also Read: How To Add Solana To MetaMask Wallet?

Conclusion 

This is all about the Nonce concept on the Ethereum Blockchain and simple ways to fix a commonly occurring error.

Read more about Nonce and its technical guides better to understand the concept from a programming perspective, if you need to.

Enjoy your transactions on MetaMask now that you know how to fix this error!

Similar Posts:

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

Closed

danfinlay opened this issue

Jul 24, 2017

· 11 comments

Assignees

@kumavis

@frankiebee

Comments

@danfinlay

Since our last version release, v3.9.1, I’ve gotten a couple reports of Transaction nonce is too low errors.

Our former trick of resetting the provider by switching the network to another and back again does not help people in this state.

Reported most recently by @gm9 in our slack, who I’ve asked for some UI state logs that could help in the investigation.

In the meanwhile, let this issue represent a bug in the nonce tracker that results in nonces being set incorrectly low.

@kumavis

@kumavis

was just able to reproduce locally

@danfinlay



Copy link


Contributor


Author

Slack user @gm9 got back to me and provided some logs, the failed transactions had no nonce set.

@dyzz

@kumavis

@FlySwatter nonce was missing from params for gm9? hmmm — thats what i was seeing before pulling latest — maybe we’re not handling an error while getting the nonceLock

that is different from @dyzz’s issue(s) some observations:

  1. log shows a few txs with "cb is not a function" as the error
  2. later (after restart? update?) its encountering a «nonce too low» error when using a nonce that already succeeded — not sure how you could encounter that
  3. i see the latest transactions from this address not in the logState tx history, but made before @dyzz published this log (@dyzz are you using a different device/wallet?)

@dyzz

@kumavis I tried to switch between different networks, and I did send a transaction from my cell phone.

@kumavis

  • we merged in fixes for [1] (most likely related to insufficient balance on resubmit)
  • we added some really verbose history logging to generally help diagnose [2] and gm9‘s issue and maybe even @libreoscar’s compact and emotionally charged contribution to this ticket «😕»

we’ll publish these today with some other fixes and try to get more insight into these bizarre nonce failures

@dyzz

@kumavis it seems that result from ‘eth_getTransactionCount’ of ropsten on infura is somehow wrong.
e.g.

https://ropsten.etherscan.io/address/0xd37448ad7949c4ad8eba5aad1a0afdd3199971d8

expected nonce: 2

actual:

https://ropsten.infura.io/metamask

curl -X POST 
  https://ropsten.infura.io/metamask 
  -d '{"jsonrpc": "2.0", "id": 1, "method": "eth_getTransactionCount", "params": [
   "0xd37448ad7949c4ad8eba5aad1a0afdd3199971d8","latest"
]}'
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x0"
}

another example:

address: 0xE89BB07333b3D792C29c744511bbCFAEE0DdD4b7
expected nonce: 82
actual: 76

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": "0x4c"
}

@egalano

Thanks for the report @dyzz, EG From INFURA here. We’re able to reproduce and are looking into it. Ill send an update shortly.

@egalano

Hi @dyzz after looking into it further, the numbers returned by Infura are correct. It looks like you are comparing the transactionCount number to etherscan’s total transaction count number which includes both In and Out transactions. If you compare the number of outgoing transactions to the value returned by the Infura RPC, Infura and Etherscan’s responses are identical. Let us know if we can help further debug this issue.

@kumavis

we’ve made some significant improvements here — folding this into #1127

There are two scenarios when the oracle sender could start receiving the message like this:

Jun 06 19:32:20 POA_AWS bridge_bridge_senderforeign_1/7bf82289aae5: {"level":50, "time":1559849540490,"msg":"Tx Failed for event Tx 0x659f73508bf4fb595b175945fd8c334072ca28efac8d79f1ee933044f221c516. nonce too low","name":"sender-foreign","eventTransactionHash":"0x659f73508bf4fb595b175945fd8c334072ca28efac8d79f1ee933044f221c516","error":"nonce too low","v":1}
  1. A validator picked up a low gas price for the transaction and the transaction was dropped out by timeout for the txpool.
  2. A transaction was sent manually by using the same private key as the bridge validator has.

As soon as the issue happens it is necessary to restart the corresponding validator’s node.

It is necessary to investigate the ability to handle such cases automatically as so the node will recover without an admin intervention.

I use web3 and provider mainnet. I do 2 transactions by contract. first is approve method and another transaction is multitransfer. I store second signature in database. if first transaction is success I send second transaction/. second transaction almost always error nonce too low`. how i can solve this problem

asked Jun 7, 2019 at 9:43

Максаткалиулы Адилет's user avatar

For proper nonce management you have 2 options :

  • Request the nr of transactions confirmed for your address with web3.eth.getTransactionCount(ethAddress), increment, send and wait for receipt before processing the next one. This is very slow if you need to have high-throughput and you are relying on a specific node to be available and to be synced.

  • You maintain your own local counter persisted at the level of the database. Use the DB’s access locks to handle possible concurrent requests and return correct values every time. You do not want to keep this counters in memory as they will be lost if your application crashes or restarts. This is very efficient as you do not need the node and you can send as many transactions as you can dish out. If something goes wrong… (nonce too low) reset to the value of web3.eth.getTransactionCount(ethAddress).

Important Note: You might wonder why not to use web3.eth.getTransactionCount(ethAddress, ‘pending’). This is because the ‘pending’ option makes the call unreliable as its hard for the nodes to have an accurate number of transaction in the queue & the memory pool.

For a better understanding how the nodes look at your message’s nonce. Check this answer here : https://ethereum.stackexchange.com/questions/2808/what-happens-when-a-transaction-nonce-is-too-high/2809#2809

And this one too : Send Raw Transaction Ethereum infura nodejs npm

answered Jun 11, 2019 at 8:34

ehanoc's user avatar

1

There may be two issues(solutions) here from my understanding;
1) You may have to manually increment nonce for the gas estimation of the multitransfer operations.
2) Some server are pretty slow these days, so either you fetch transactionReceipt(poll) of first transaction before doing the second to be sure that it has been mined. This way you would likely have the right nonce for second transaction. However, if you are lazy to do this, just are reasonable delay between the two transactions.

answered Jun 8, 2019 at 10:37

user618677's user avatar

user618677user618677

4,8696 gold badges23 silver badges24 bronze badges

1

DRAFT — ЧЕРНОВИК (Статья находится в процессе доработки)

В последнее время нагрузка на сеть эфира выросла. К тому же часто проводятся ICO которые могут поднять нагрузку на сеть почти в три раза.

Увеличение нагрузки на сеть может привести к ситуации когда ваша транзакция находится в состоянии pending очень долго.

Дело в том что майнеры в первую очередь стараются взять в обработку самые дорогие транзакции. Поэтому у транзакций с большей стоимостью газа шанс обработаться выше. Когда нагрузка на сеть возрастает транзакции с маленькой стоимостью газа могут ожидать своей очереди по несколько дней и даже недель.

На момент написания статьи при нормальной нагрузке на сеть количество транзакций в состоянии pending от 2000 до 4000 тысяч. Когда кто-от начинает ICO количество транзакций в pending  может возрасти до 8-11 тысяч. На изображении как раз показан такой резкий скачек.

Когда транзакция очень долго находится в pending пользователь пытается отправить такую же транзакцию но с большим газом, потом еще и еще. В надежде что хоть одна из них пройдет. И все эти транзакции остаются в pending.

Дело в том что транзакции с адреса как-правило обрабатываются в порядке очереди. Поэтому пока не обработана самая первая — запирающая транзакция, остальные будут ждать.

Почему транзакция pending от появляется то исчезает и время ожидания обнуляется?

Когда транзакция попадает в состояние pending, это значит что нода взяла вашу транзакцию к себе в обработку. И сейчас ищет блок. Однако, блок может найти быстрее другая нода, которая не содержит в себе вашу транзакцию. В этом случае нода которая взяла вашу транзакцию «выплевывает» ее и теперь вашу трназакцию в обработку может взять другая нода. В этом случае время обнуляется.

Как протолкнуть или удалить запирающую транзакцию

Стоит отметить, что ожидание транзакции 2-3 часа хоть и не является нормальным, но все же допустимо.

Транзакции в блоке имеют свои уникальные номера — nonce. Если отправить в сеть две транзакции с одинаковым nonce, то только одна из них обработается. А другая будет считаться некорректной. Поэтому нам достаточно повторить транзакцию с тем же nonce но увеличить стоимость газа. В этом случае нода возьмет транзакцию с наибольшей стоимостью в обработку, а запирающую отклонит как некорректную. И мы решим нашу проблему.

Как это сделать?

Итак, если вы хотите именно удалить запирающую транзакцию, то достаточно отправить пустую транзакцию с высокой ценой газа. Возможности установить цена газа нет в кошельке mist или ethereum wallet. Поэтому мы воспользуемся MyEtherWallet .

  1. Найдите запирающую транзакцию. Для этого зайдите на etherscan.io и введите в поле address адрес с которого отправляли транзакции и нажмите кнопку go.
  2. Появится список всех транзакций с вашего аккаунта, нажмите на ссылку «pending Txns»
  3. Перед вами отобразится список всех транзакций в состоянии pending, а также отобразится цена газа. Как правило запирающая транзакция самая первая. Так и есть в мы видим что в первой транзакции цена газа 1 Gwei. А следующая уже за ней в очереди хоть и имеет цену газа 21 Gwei, но не обработается пока не обработается запирающая транзакция. Нажмите на ссылку хэша запирающей транзакции чтобы посмотреть подробности.
  4. В подробностях скопируйте число none и адрес from (собственно это адрес аккаунта с которого вы отправляли транзакцию)
  5. Теперь зайдите в на на https://www.myetherwallet.com/  и выберите вкладку Send Offline (Оффлайн перевод).
  6. Теперь из всех полей нам надо заполнить следующие:
    • From Address — указываем адрес с которого отправляли запирающую транзакцию
    • To Address — любой существующий адрес
    • Gas price — тут нам надо указать цену газа. Наша запирающая транзакция стоила 1 Gwei. Что никуда не годится. Стандартно MyEtherWallet использует цену газа 21 Gwei. Поэтому мы поставим чуть выше — 30 Gwei. Если посмотрим на надпись справа от поля, то увидим там Wei. 1 GWei = 1000000000 Wei. Поэтому нам нужно написать 30000000000.
    • nonce — вставляем то значение, которое скопировали в подробностях транзакции
    • Value amount — указываем 0
  7. Теперь наша задача разблокировать кошелек удобным вам способом. Сделайте это самостоятельно. После разблокировки вам будет доступна кнопка generate transaction. Нажимаем на нее. А затем нажмите на send transaction.
  8. В появившемся окне нажмите синюю кнопку «Yex, I am sure! Make transaction.»

Теперь ваша транзакция должна через некоторое время удалиться.  Откройте etherscan.io с вашим адресом и наблюдайте за процессом. Если среди последующих транзакций есть с низким газом, то для них также нужно проделать эту процедуру. В нашем примере после транзакции с 1 Gwei идет транзакция уже с 21 GWei, поэтому нам достаточно убрать только первую.

Большое спасибо коллегам из Fidcom , которые столкнулись с проблемой, нашли способ ее решения , разобрались и предоставили информацию. Также в материалах использовалась информация с www.reddit.com.

Читайте также

Понравилась статья? Поделить с друзьями:
  • Non hp supply installed ошибка что делать
  • Nokiasoftwarerecoverytoolinstaller ошибка 0x80070002
  • Nokia software recovery tool ошибка 0x80070002
  • Nokia 515 ошибка 005
  • Noisecancelingengine exe ошибка приложения