How a transaction works· 2 of 4

Sequence numbers and Tickets

Each transaction takes the next number in line. Tickets let you skip the line.

4 minMedium

Key points

  • Each transaction must use the account's next sequence number.
  • A transaction that fails with a tec code still uses its number.
  • Tickets set numbers aside, to send later in any order.

The lesson

  1. Every account has a , like a counter at a deli. Each transaction must use the next number. That stops anyone from playing the same transaction twice.

  2. Numbers go strictly in order. If number 7 never gets in, 8 has to wait. The account is stuck until 7 is used. Fix it by sending something, even a tiny no-op, with number 7.

  3. A failed transaction can still use its number. If it fails with a tec code, it is written into the ledger anyway. Its number is spent and its fee is burned.

  4. Tickets fix the waiting. A TicketCreate sets numbers aside now. Later, a transaction can use any Ticket, in any order. That helps when signers need days to sign one, or when you send many.

  5. Each Ticket you hold locks a small owner reserve until you use it.

Check yourself3 questions
1. Your transaction with Sequence 7 never got in. What happens to Sequence 8?
2. A Payment fails with tecUNFUNDED_PAYMENT. Is its sequence number used?
3. How many Tickets can an account hold at once?
Next lessonFrom signed to final