orymsolana.xyz

Solana durable nonces for transactions that outlive blockhash expiry

A standard Solana transaction must reference a recent blockhash, which is valid for roughly 150 slots after the latest finalized block. In practice, this gives you about one minute to submit the transaction before the network rejects it. This works fine when you sign and send in the same session. It fails when you need to sign a transaction offline and submit it hours or days later. Airdrop claims, recurring payments, and certain DeFi operations all face this problem. Durable nonces solve it.

How a durable nonce works

A durable nonce replaces the recent blockhash in a transaction. Instead of expiring after 150 slots, the nonce stays valid until someone explicitly advances it. The transaction can be signed offline, stored, and submitted whenever the signer chooses.

The nonce lives inside an on-chain account. This account stores a single value: the current nonce. Every transaction that uses this nonce must reference the exact value stored in the account. Once the network processes the transaction, the nonce advances to a new value. You cannot replay the same transaction.

The mechanism is straightforward. A durable nonce account is created with a rent-exempt balance, which stays locked while the account exists. The account also has a nonce authority: the only account permitted to advance the nonce.

Creating and using a nonce account

To create a durable nonce account, you generate a new keypair for the account and fund it with enough SOL to be rent-exempt. You then issue a CreateNonceAccount instruction. The system program handles the rest.

Once the account exists, you can generate a nonced transaction. The process is:

When the transaction lands on-chain, the AdvanceNonceAccount instruction runs first. It checks that the nonce matches, increments it, and then the rest of your instructions execute. The same nonce value cannot be used again.

The nonce authority's power

The nonce authority holds significant control. It can advance the nonce at any time without executing any other instructions. This effectively invalidates any pending transaction that still uses the old nonce value. This is a feature: if you sign a transaction and later decide not to send it, the authority can simply advance the nonce and the signed transaction becomes useless. The authority can also authorize a new authority, transferring control to another account.

The risk of account closure

There is a more dangerous power. The nonce authority can close the nonce account and withdraw the entire rent-exempt balance. This destroys the nonce. Any transaction signed against that nonce becomes permanently invalid.

This matters if the nonce authority is a program, a multi-sig, or someone you do not fully trust. If the authority closes the account, your signed-but-unsubmitted transactions are dead. You cannot recover them. The rent-exempt balance is typically 0.0015 SOL. That is not a large amount, but the risk is not the balance. The risk is that a transaction you intended to submit later can never be submitted.

Practical considerations

Durable nonces are not a replacement for recent blockhashes. They are a specific tool for a specific problem. If you can submit a transaction within one minute, use a recent blockhash. If you need to sign offline and submit later, use a durable nonce.

The nonce authority should be a key you control directly. If you delegate authority to a program or another party, you accept that they can close the account or advance the nonce at any time. Some wallets and dApps implement durable nonces under the hood; others do not. If you are building a service that needs offline signing, you must handle the nonce account lifecycle yourself. The Solana CLI provides commands for creating and managing nonce accounts; the SDKs expose the relevant instructions.

Durable nonces are an old feature. They have been part of Solana since before mainnet beta. They are not experimental. They are also not widely used, because most transactions do not need to outlive blockhash expiry. When you do need them, they work exactly as specified.

Not financial advice. orymsolana.xyz publishes market data and general information about digital assets. Crypto assets are volatile and you can lose everything you put in. Nothing here is a recommendation to buy, sell or hold, and we make no price predictions.

Prices are sourced from third parties and may be delayed or wrong. Verify anything you intend to act on against a primary source.

Back to solana