> For the complete documentation index, see [llms.txt](https://leather.gitbook.io/guides/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://leather.gitbook.io/guides/transactions/nonces.md).

# Nonces

How do I edit the nonce for a Stacks transaction before sending with the Leather?

<mark style="color:red;">Warning:</mark> Do not edit the nonce of a transaction unless you know what you are doing

### Introduction

Nonces on Stacks are used to dictate the order in which transactions have to be ordered by miners. A transaction with nonce 8 can't be processed (mined) before a transaction with nonce 7 is processed. A pending transaction with nonce 8, without a pending (or confirmed) transaction with nonce 7 can never get processed. In normal circumstances, the wallet is expected to set the correct nonce for you. A nonce can only be used once per address starting with 0.&#x20;

### Editing the nonce

Editing the nonce is only possible before confirming the transaction. To do so follow these steps:

1. On the confirmation screen, see the lower left corner and click “edit nonce”.

<figure><img src="https://2711255060-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgNoCNE0bvsne0MKkDx44%2Fuploads%2FXuT7SPMssEdR6ZhnlmLQ%2Fedit-nonce.png?alt=media&amp;token=d366a752-4ce3-41c1-9150-f096eeced1e4" alt=""><figcaption><p>Step 1: Click "edit nonce" below the fee options and above the button to continue.</p></figcaption></figure>

2. Edit the number to the preferred nonce and apply.

<figure><img src="https://2711255060-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgNoCNE0bvsne0MKkDx44%2Fuploads%2Fn9w9UXnjxm3z1TOXaaHc%2Fedit-nonce-b.png?alt=media&amp;token=2b158801-a06b-4b78-9402-7f1390f953e7" alt=""><figcaption><p>Step 2: Edit the nonce, and apply</p></figcaption></figure>

Note that the miners process transactions in order of the nonce. Lowest first. And no gaps are allowed. An address that has not yet sent any transactions will send the first transaction with a nonce value of “0”, then “1”, “2”, etc..

### Additional sources

[**Gamma.io - How do nonces work**](https://support.gamma.io/hc/en-us/articles/6908193338131-How-do-nonces-work-)

[**Leather.io Guides - Pending transactions, and why they are pending**](/guides/transactions/pending-transactions.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://leather.gitbook.io/guides/transactions/nonces.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
