Skip to main content

How do you manually set a custom nonce to troubleshoot issues? (Ex: Failed/Stuck Transaction)

Updated over 3 months ago

Setting a custom nonce is simple, and can be done usually within the "Edit nonce", "Advanced", or "Custom" menu when submitting a transaction within a wallet. A field will appear, typically with a preset nonce, and the option to manually type in a new nonce.

The main prerequisite is determining the current nonce for your account and re-submitting or otherwise addressing the issue at hand by submitting transactions with the correct nonce. Remember, there is a single acceptable nonce from a given account at all times. If you do not submit transactions with the single acceptable nonce, no future transactions can ever be accepted as valid transactions and they will all fail until the nonce is rectified and correct.


Troubleshooting issues with nonces

Step One: Identify your account's current nonce using the Stacks Explorer. This is the single acceptable nonce from your given account. You can paste your STX address in the searchbar and your nonce will be listed as one of the main highlights of your address.

Nonce 1b.png

Step Two: Identify the nonces of your pending transactions to see why they aren't being accepted as valid transactions. You can do this by clicking on the pending transaction or any other transaction in the ledger. The nonces on these transactions may be too high or too low (in other words, they may be duplicates or may have skipped nonces). In the screenshot below, you'll see the most recent transaction that successfully confirmed was 117, hence why in the prior screenshot in Step 1, the account's current nonce is 881. In this example, the single acceptable nonce for the next sequential transaction will be 118.

Nonce 2.png


Step Three: Create a new transaction (or re-create your original transaction), but manually typing in the single acceptable nonce as the custom nonce. You can usually do this by exposing the "Advanced" or "Custom" transaction menu before submitting your transaction. If you don't have a transaction you need to submit, you can send any amount of STX or any other token to another wallet. For example, you can "Create an Account" under the same Xverse wallet and then send 1 STX (or any amount) to the newly created address with the correct nonce assigned to the STX transfer. Any transaction will do as long as it is accepted as a valid transaction.

Screenshot 2025-01-27 at 8.19.44 PM.png

Step Four: Submit the transaction and wait for it to confirm. If your goal is to render a transaction unstuck, you'll need to make sure your same-nonce-transaction has a higher fee than the previous one.

That's it! It is that easy!

Did this answer your question?