3

I've been reading about an account's nonce, that it's supposed to be an incremental number that increments with every transaction. I found about transactions pool and queue, about what happen if you don't send a consecutive nonce, but I couldn't find someone that would tell me if this nonce has a limit.

If I keep making transactions from an account and I increment the nonce by 1 each time, will there be a time that I reach the maximum transactions that can be performed for an account?

I also thought that maybe this nonce is per block, so once transactions were mined the nonce may be restarted so there would be not actual limit. But I saw examples that use geth's getTransactionsCount() method to calculate the next nonce, so it couldn't be per block.

1 Answer 1

4

A transaction can only be mined if its nonce is 1 greater than the signer's previous used nonce (the exception being an account's first tx, where the nonce must be zero). In other words, a transaction can only be mined if the nonce is the total number of transactions the signer has created (excluding the current tx).

There is no defined maximum for account nonce, either, so it can grow indefinitely. Of course "unlimited" isn't realistic, so clients will start breaking down at a point. Without reading into current implementations, I'm assuming they will all be fine until at least 2^64 nonce value, which is orders of magnitudes more than I expect Ethereum to ever process. Past 64 bits, all client implementations are very familiar with 2^256 sized numbers since that's what the EVM operates on, so if a client isn't prepared for nonces that large, it should be trivial to update to handle them. However it's impossible to process

Math for 2^64 size nonce: If we take the record high transactions per day of ~1.3 million last December and assume 1 address were to send all of those, it would take 40 billion years to do 2^64 transactions, which is 3 times the age of the observable universe.

Math for 2^256: Long story short, it's 2.4*10^68 years of 1.3 million transactions per day from 1 address.

1
  • 2**64 is only 5,845,420,460 Tx a second for 100 years. A crappy i3 single core processes about that many instructions per second now. Easy game. I'm ready to start spamming Ropsten now to test it. :-) Commented Jul 26, 2019 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.