<p>For a transaction to be processed it <strong>must</strong> use the very next available sequence number (as returned by <a href="https://ripple.com/wiki/JSON_Messages#account_info" rel="nofollow noreferrer">account_info</a>).</p>
<p>If an otherwise valid signed transaction has a sequence number too small (matching a previously used sequence number), then the transaction is guaranteed to never be valid and will produce an error and should be discarded by servers receiving it.</p>
<p>If an otherwise valid signed transaction uses a sequence number (currently) too high, then the transaction is not currently valid and will produce an error but the transaction may become valid (and a server may retain and automatically attempt to apply the transaction at that time). As well anything that has seen the signed transaction could replay it once the &quot;missing&quot; sequence numbers on the account are used. Such transactions are referred to as <em>in-flight</em> and their outcome is undetermined until either the account has a transaction with that sequence number included in a fully validated ledger (possibly a <a href="https://ripple.com/wiki/Transactions#Use_as_a_NOP" rel="nofollow noreferrer">No-OP transaction</a> just to consume/advance the sequence number) or a fully validated ledger with a ledger sequence at least as high as the <a href="https://ripple.com/wiki/Transactions#Basic_Transaction_Format" rel="nofollow noreferrer">LastLedgerSequence</a> specified in the signed transaction is seen.</p>
<p>From <a href="https://ripple.com/wiki/Transactions#Use_as_a_NOP" rel="nofollow noreferrer">https://ripple.com/wiki/Transactions#Use_as_a_NOP</a>:</p>
<blockquote>
<p>When multiple transactions are yet to be finalized (known to be in-flight), and a local error occurs such that there are following transactions in-flight, the following transactions will temporarily fail until the sequence number used by the local failure is consumed. A transaction is in-flight if it hasn't been included in a fully-validated ledger, but also isn't guaranteed not to be.</p>
<p>…</p>
<p>The in-flight transactions may be later replayed by anyone who has them. It is important for predictability and reliability to consume the sequence number of the bad transaction and replay the in-flight transactions until they are finalized.</p>
</blockquote>
<p>And from <a href="https://ripple.com/wiki/Transactions#Basic_Transaction_Format" rel="nofollow noreferrer">https://ripple.com/wiki/Transactions#Basic_Transaction_Format</a>:</p>
<blockquote>
<p>LastLedgerSequence (optional)</p>
<p>Highest valid ledger number that a transaction can appear in. If this is specified, and the transaction is not included by the time the ledger reaches the specified ledger sequence number, then the transaction is considered to have failed and will no longer be valid.</p>
</blockquote>
<p>So specificly,</p>
<blockquote>
<p>For example, if I have one Payment Tx with Sequence 123, and then want to create another transaction with a Sequence 200, will it go through?</p>
</blockquote>
<p>Not until transactions with sequence 124 through 199 go through. Until then servers will report a &quot;missing sequence number&quot; error on such transactions. Until some transaction with sequence 200 is applied to your account you cannot know that something somewhere won't re-submit your &quot;old&quot; signed payment transaction the moment they see your sequence 199 transaction (i.e. even though you get an error the transaction could be applied later).</p>
<blockquote>
<p>Also, I understand that the transaction Sequence numbers cannot be descending, so I couldn't submit a Tx with a Sequence of 100.</p>
</blockquote>
<p>Such a transaction will always get a &quot;past sequence number&quot; error and never be valid.</p>

CC BY-SA 3.0
2014-07-08T18:12:50.380Z
2014-07-08T18:12:50.380Z
2020-06-16T11:10:03.350Z
dchapes
<p>I am wondering whether a <a href="https://ripple.com/wiki/Transactions#Basic_Transaction_Format" rel="nofollow">Ripple Transaction</a> with a Sequence number that ships over a few numbers from the previous Sequence number be accepted as a valid transaction in the Ripple Network?</p>

<p>For example, if I have one Payment Tx with Sequence 123, and then want to create another transaction with a Sequence 200, will it go through?</p>

<p>Also, I understand that the transaction Sequence numbers cannot be descending, so I couldn't submit a Tx with a Sequence of 100. Is this correct?</p>

<transactions><protocol><ripple><sequence>
Can a Ripple Transaction Sequence have gaps?
ThePiachu
# Can a Ripple Transaction Sequence have gaps?

(Asked by: username_0 on 2014-07-07)

I am wondering whether a [Ripple Transaction](https://ripple.com/wiki/Transactions#Basic_Transaction_Format) with a Sequence number that ships over a few numbers from the previous Sequence number be accepted as a valid transaction in the Ripple Network?

For example, if I have one Payment Tx with Sequence 123, and then want to create another transaction with a Sequence 200, will it go through?

Also, I understand that the transaction Sequence numbers cannot be descending, so I couldn't submit a Tx with a Sequence of 100. Is this correct?

**Tags:** transactions, protocol, ripple, sequence


---

## 1 answers

### Answer by username_1 on 2014-07-08. Score: 3 | Accepted answer

For a transaction to be processed it **must** use the very next available sequence number (as returned by [account\_info](https://ripple.com/wiki/JSON_Messages#account_info)).

If an otherwise valid signed transaction has a sequence number too small (matching a previously used sequence number), then the transaction is guaranteed to never be valid and will produce an error and should be discarded by servers receiving it.

If an otherwise valid signed transaction uses a sequence number (currently) too high, then the transaction is not currently valid and will produce an error but the transaction may become valid (and a server may retain and automatically attempt to apply the transaction at that time). As well anything that has seen the signed transaction could replay it once the "missing" sequence numbers on the account are used. Such transactions are referred to as *in-flight* and their outcome is undetermined until either the account has a transaction with that sequence number included in a fully validated ledger (possibly a [No-OP transaction](https://ripple.com/wiki/Transactions#Use_as_a_NOP) just to consume/advance the sequence number) or a fully validated ledger with a ledger sequence at least as high as the [LastLedgerSequence](https://ripple.com/wiki/Transactions#Basic_Transaction_Format) specified in the signed transaction is seen.

From <https://ripple.com/wiki/Transactions#Use_as_a_NOP>:

> When multiple transactions are yet to be finalized (known to be in-flight), and a local error occurs such that there are following transactions in-flight, the following transactions will temporarily fail until the sequence number used by the local failure is consumed. A transaction is in-flight if it hasn't been included in a fully-validated ledger, but also isn't guaranteed not to be.
>
> …
>
> The in-flight transactions may be later replayed by anyone who has them. It is important for predictability and reliability to consume the sequence number of the bad transaction and replay the in-flight transactions until they are finalized.

And from <https://ripple.com/wiki/Transactions#Basic_Transaction_Format>:

> LastLedgerSequence (optional)
>
> Highest valid ledger number that a transaction can appear in. If this is specified, and the transaction is not included by the time the ledger reaches the specified ledger sequence number, then the transaction is considered to have failed and will no longer be valid.

So specificly,

> For example, if I have one Payment Tx with Sequence 123, and then want to create another transaction with a Sequence 200, will it go through?

Not until transactions with sequence 124 through 199 go through. Until then servers will report a "missing sequence number" error on such transactions. Until some transaction with sequence 200 is applied to your account you cannot know that something somewhere won't re-submit your "old" signed payment transaction the moment they see your sequence 199 transaction (i.e. even though you get an error the transaction could be applied later).

> Also, I understand that the transaction Sequence numbers cannot be descending, so I couldn't submit a Tx with a Sequence of 100.

Such a transaction will always get a "past sequence number" error and never be valid.


---

