Summary
Durable nonce transactions replace the recent blockhash with a stored nonce value, removing the 150 slot expiry window for a transaction. This enables offline signing and delayed submission.
Durable nonces may be deprecated in a future release. See SIMD discussion for details.
Durable nonces
A durable nonce transaction replaces the recent blockhash with a stored nonce value, removing the 150 slot expiry window. This enables offline signing and delayed submission.
How nonce transactions work
A nonce account is a System Program-owned account that stores a
State::Initialized value containing three fields: an authority pubkey (who
can advance the nonce), a durable nonce value (a hash derived from a recent
blockhash), and lamports per signature (the fee rate when the nonce was last
advanced).
To use a durable nonce:
- Create and initialize a nonce account using
CreateAccount+InitializeNonceAccount - Build the transaction with
AdvanceNonceAccountas the first instruction and the nonce value as therecent_blockhash - Sign the transaction (can be done offline, since the nonce does not expire)
- Submit when ready
Nonce detection
The runtime detects nonce transactions by checking whether the first instruction
(index
NONCED_TX_MARKER_IX_INDEX
= 0) is a call to the System Program with the AdvanceNonceAccount instruction.
The nonce account must be the first account of that instruction and must be
writable. See
get_durable_nonce.
Nonce validation flow
When a transaction's recent_blockhash is not found in the BlockhashQueue,
the validator checks if it is a valid nonce transaction via
check_transaction_age:
- The nonce's stored
durable_noncemust differ from the next durable nonce (derived from the current blockhash). This ensures the nonce has not already been used in this block - The nonce account must be loaded and must parse as
State::Initialized - The stored
durable_noncemust match the transaction'srecent_blockhash
The nonce authority signing check is performed later
(validate_transaction_nonce).
If all checks pass, the nonce is advanced to the next durable nonce value before execution begins. On execution failure, the advanced nonce and the fee-deducted fee payer are still committed (preventing replay while collecting fees).
Nonce failure behavior
If a nonce transaction fails validation (nonce already used, authority not signed, account not found), the entire transaction is dropped. No fees collected, no state changes.
If a nonce transaction passes validation but execution fails (an instruction returns an error), the nonce is still advanced and fees are still collected. This prevents the transaction from being replayed while ensuring the validator is compensated.
Is this page helpful?