Nonce
A number used once to prevent replays and order operations. In TON wallets the role of the nonce is played by seqno, a counter that increments with every outbound transaction.
Aliases: sequence number, seqno, anti-replay number
Nonce (from “number used once”) is a unique value bound to a single operation that never repeats. In blockchains a nonce serves two purposes: preventing replay attacks (re-broadcasting the same transaction) and ordering operations.
In TON: seqno
TON uses seqno — a counter field in the data section of the wallet contract. Each outbound transaction:
- Is signed with the current seqno value.
- The contract checks that the seqno in the signature matches the current state.
- On match, the transaction executes and seqno increments.
- On mismatch, the transaction is rejected.
The same signed transaction cannot be broadcast twice: after the first execution seqno has advanced to N+1, while the signature is bound to N. Replays simply do not apply.
Where to see it
Seqno is visible on Tonscan and Tonviewer on the wallet page, and is exposed via the contract’s seqno() get method. Before signing, a wallet client first reads the current value.
Races and edge cases
If a user fires several transactions from the same wallet in rapid succession, seqno races can occur: the first transaction has not been included yet, but the wallet already reads the old seqno and signs the second one with the same number. The network accepts the first and rejects the second. Modern wallets (Tonkeeper, MyTonWallet) wait for confirmation before re-reading. High-frequency scenarios (exchange highload wallets) use a different scheme — query_id instead of seqno — that allows parallel sends.
Comparison with other networks
The concept is universal but the implementation varies:
- Ethereum. Account nonce — a state field that increments on every transaction.
- Bitcoin. No address nonce; instead each transaction spends specific UTXOs, which can never be spent twice.
- Solana. Nonce accounts plus recent blockhash — a hybrid.
In signature schemes, “nonce” also has a separate meaning. ECDSA (Bitcoin / Ethereum) leaks the private key if a signing nonce is reused. TON’s Ed25519 uses a deterministic nonce derived from the message and key and is immune to that class of bug.