Nonces and Ordering
Transaction sequencing.
Why Order Matters
Imagine sending two transactions: first deposit, then withdraw. If they execute out of order, the withdrawal could fail.
The nonce guarantees your transactions run in the exact order you intend.
What Is an Account Nonce?
An account nonce is a counter tracking how many transactions an account has sent. It starts at 0 and increases by 1 with each confirmed transaction.
Note: this is different from the mining nonce in Proof of Work.
Account history:
tx with nonce 0 (1st tx)
tx with nonce 1 (2nd tx)
tx with nonce 2 (3rd tx)
next expected nonce: 3All lessons in this course
- What Is Gas
- Transaction Lifecycle
- Gas Limits and Fees
- Nonces and Ordering